dimanche 26 janvier 2020

Laravel package error on file uploading using Spatie\MediaLibrary

i just try to upload the image to the server using Spatie\MediaLibrary package .Then laravel gives this error of not found function. I tried all the solution no one worked

This is the code that i am using

> public function update(Request $request, Channel $channel)
>     {
>        if($request->hasFile("image")){
>          $channel->addAllMediaFromRequest('image')->toMediaCollection('images');
>        }
>     }

please click here to see the error message

use Spatie\MediaLibrary\HasMedia\HasMedia;
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
use \YouTube\Model;
use App\User;

class Channel extends Model implements HasMedia
{
    use HasMediaTrait;
    public function user()
    {
        return $this->belongsTo(User::class);
    }
}

this is my model



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire