public function updatePhotoCover(Photo $photo)
    {
        // get the photoable
        //$photoable = input('photoable_type_name')::find(input('photoable_id'));

        // set all the albums to cover = false
        Photo::where('photoable_id', input('photoable_id'))
            ->where('photoable_type', input('photoable_type'))
            ->update(['is_cover' => false]);

        // update this photo to is_cover
        $photo->update(['is_cover' => true]);

        return json_response();
    }
public function updatePhotoCover(Photo $photo)
    {
        // get the photoable
        //$photoable = input('photoable_type_name')::find(input('photoable_id'));

        // set all the albums to cover = false
        Photo::where('photoable_id', input('photoable_id'))
            ->where('photoable_type', input('photoable_type'))
            ->update(['is_cover' => false]);

        // update this photo to is_cover
        $photo->update(['is_cover' => true]);

        return json_response();
    }
public function updatePhotoCover ( Photo $ photo ) { // get the photoable //$photoable = input('photoable_type_name')::find(input('photoable_id')); // set all the albums to cover = false Photo :: where ( 'photoable_id' , input ( 'photoable_id' ) ) -> where ( 'photoable_type' , input ( 'photoable_type' ) ) -> update ( [ 'is_cover' => false ] ) ; // update this photo to is_cover $ photo -> update ( [ 'is_cover' => true ] ) ; return json_response ( ) ; }
Update the album's cover image
@param Photo $photo
@return \Illuminate\Http\JsonResponse
Update the album s cover image