vendredi 1 décembre 2017

Laravel 5.5 - "Call to a member function sync() on null" Error

I'm trying to save post images. There is no problem with saving images or moving images to the uploads directory. But in sync section, it gives me that error.

(I have three tables. posts, media and pivot table)

Here is sync codes;

$media = Media::where('created_at', '>=', Carbon::now()->subSecond(10))->pluck('id');

$post->media()->sync($media, true);

Any advice ?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2i7eFca
via IFTTT

Aucun commentaire:

Enregistrer un commentaire