Why does not the class work for me, Class 'Image' not found?

0
use Image;



    $empresa= empresa::find($id);
   $empresa->fill($request->all());

    if ($request->hasFile('logo')) 

      {
     $imagen=$request->file('logo');

      $image_name = time(). '.'. $imagen->getClientOriginalName();
      $destination_path= public_path()."/image_empresas";
     Image::make('logo')->save($destination_path, $image_name);

     $empresa->logo = $image_name;
   Storage::delete($image_name);
    }

    $empresa->save();

the code works for me if I do not use the

  Image::make('logo')->save($destination_path, $image_name);
    
asked by darling peralta 26.11.2017 в 04:04
source

1 answer

0

The correct steps to use the library would be:

1. Positioned in the root of your project run:

composer require intervention/image

2. In the /config/app.php file in the providers section add at the end:

Intervention\Image\ImageServiceProvider::class,

3. In the /config/app.php file within the aliases section add at the end:

'Image' => Intervention\Image\Facades\Image::class,

After these steps should work without problems

    
answered by 28.11.2017 в 20:04