-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Closed

Description
- Laravel Version 5.3
- PHP Version: 5.6
- Database Driver & Version: MySql
When i try to use the store method from the documentation:
https://laravel.com/docs/5.3/filesystem#file-uploads i got error: Method store does not exist.
Also i've wached this video in laracasts, writing the exact same code: https://laracasts.com/series/whats-new-in-laravel-5-3/episodes/12 and the result is the same.
This is my code:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\File;
use App\Http\Requests;
class UserController extends Controller {
protected $validationRules = [
'avatar' => 'mimes:jpg,png,gif,jpeg'
];
public function store(Request $request){
$validator = Validator::make($request->all(), $this->validationRules);
if($validator->passes()){
$path = $request->file('avatar')->store('avatars'); // here is the problem
dd($path);
}else{
dd($validator->messages());
}
}
Route::post('/user/store', 'UserController@store');
Metadata
Metadata
Assignees
Labels
No labels