2
votes

i followed this steps https://github.com/GrahamCampbell/Laravel-Flysystem

composer update "graham-campbell/flysystem": "~1.0" DONE

php artisan vendor:publish DONE

i have this code

public function store()
    {
      $file = Request::file('images');
      $extension = $file->getClientOriginalExtension();
        Storage::disk('local')->put($file->getFilename().'.'.$extension,                     File::get($file));
      $entry = new Fileentry();
      $entry->mime = $file->getClientMimeType();
      $entry->original_filename = $file->getClientOriginalName();
      $entry->filename = $file->getFilename().'.'.$extension;
   }

my form

@extends('app')

@section('content')

<h1>Create New Timelinemeta</h1>
<form method="POST" action="{{ url('timelinemeta/store') }}" enctype="multipart/form-data">
  <input type="hidden" name="_token" value="{{ csrf_token() }}">
  <div class="form-group">
    <label for="">Images</label>
    <input type="file" class="form-control" name="images">
  </div>
  <button type="submit" class="btn btn-default">Submit</button>
</form>
@endsection

having an error:

Class 'App\Http\Controllers\Storage' not found
2

2 Answers

22
votes

You need to import Storage class because it's a facade.

Add:

use Storage;

at top of your controller.

For example:

<?php

namespace App\Http\Controllers;

use Storage;

class YourController {
   ...
}
3
votes

you can also do :

$disk = \Storage::disk('s3');

Means you must prepend \ before the storage