public function getCoverPhotoAttribute()
    {
        $photos = $this->photos;
        if ($photos->count() >= 1) {
            // get the cover photo
            $photo = $photos->where('is_cover', true)->first();
            if ($photo) {
                return $photo;
            }

            // no photo marked as cover - return first
            return $photos->first();
        }

        // no photos uploaded yet
        return false;
    }
public function getCoverPhotoAttribute()
    {
        $photos = $this->photos;
        if ($photos->count() >= 1) {
            // get the cover photo
            $photo = $photos->where('is_cover', true)->first();
            if ($photo) {
                return $photo;
            }

            // no photo marked as cover - return first
            return $photos->first();
        }

        // no photos uploaded yet
        return false;
    }
public function getCoverPhotoAttribute ( ) { $ photos = $ this -> photos ; if ( $ photos -> count ( ) >= 1 ) { // get the cover photo $ photo = $ photos -> where ( 'is_cover' , true ) -> first ( ) ; if ( $ photo ) { return $ photo ; } // no photo marked as cover - return first return $ photos -> first ( ) ; } // no photos uploaded yet return false ; }
Get the cover photo attribute
@return bool
Get the cover photo attribute