classes/Models/Base.php
public function getAdminThumbAttribute($width = 40, $height = 40)
    {

        // Check if there are images for the model
        if (!method_exists($this, 'images')) {
            return;
        }

        $images = $this->images;
        if ($images->isEmpty()) {
            return;
        }

        // Get null-named (default) images first
        return $images->sortBy('name')->first()->crop($width, $height)->url;
    }
public function getAdminThumbAttribute($width = 40, $height = 40)
    {

        // Check if there are images for the model
        if (!method_exists($this, 'images')) {
            return;
        }

        $images = $this->images;
        if ($images->isEmpty()) {
            return;
        }

        // Get null-named (default) images first
        return $images->sortBy('name')->first()->crop($width, $height)->url;
    }
public function getAdminThumbAttribute ( $ width = 40 , $ height = 40 ) { // Check if there are images for the model if ( ! method_exists ( $ this , 'images' ) ) { return ; } $ images = $ this -> images ; if ( $ images -> isEmpty ( ) ) { return ; } // Get null-named (default) images first return $ images -> sortBy ( 'name' ) -> first ( ) -> crop ( $ width , $ height ) -> url ; }
The URL for the thumbnail

@return string URL
The URL for the thumbnail