In my routes.php
file I have :
Route::get('/', function () {
return view('login');
});
Route::get('/index', function(){
return view('index');
});
Route::get('/register', function(){
return view('register');
});
Route::post('/register',function(){
$user = new \App\User;
$user->username = input::get('username');
$user->email = input::get('email');
$user->password = Hash::make(input::get('username'));
$user->designation = input::get('designation');
$user->save();
});
I have a form for users registration. I am also taking the form inputs value in the routes.php
.
But the error comes up when I register a user . Error:
FatalErrorException in routes.php line 61:
Class 'input' not found
It is Input
and not input
.
This commit removed Input
facade definition from config/app.php
hence you have to manually add that in to aliases
array as below,
'Input' => Illuminate\Support\Facades\Input::class,
Or You can import Input
facade directly as required,
use Illuminate\Support\Facades\Input;
For laravel <
5.2:
Open config/app.php
and add the Input
class to aliases
:
'aliases' => [
// ...
'Input' => Illuminate\Support\Facades\Input::class,
// ...
],
For laravel >=
5.2
Change Input::
to Request::
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With