In my routes.php
file I have :
Route::get(\'/\', function () {
return view(\'login\');
});
Route::get(\'/index\', function(){
return v
This clean code snippet works fine for me:
use Illuminate\Http\Request;
Route::post('/register',function(Request $request){
$user = new \App\User;
$user->username = $request->input('username');
$user->email = $request->input('email');
$user->password = Hash::make($request->input('username'));
$user->designation = $request->input('designation');
$user->save();
});
In larvel => 6 Version:
Input no longer exists In larvel 6,7,8 Version. Use Request
instead of Input
.
Based on the Laravel docs, since version 6.x Input has been removed.
The Input Facade
Likelihood Of Impact: Medium
The
Input
facade, which was primarily a duplicate of theRequest
facade, has been removed. If you are using theInput::get
method, you should now call theRequest::input
method. All other calls to the Input facade may simply be updated to use theRequest
facade.
use Illuminate\Support\Facades\Request;
..
..
..
public function functionName(Request $request)
{
$searchInput = $request->q;
}
Add this in config/app.php under aliases:-
'Input' => Illuminate\Support\Facades\Input::class,
Miscall of Class it should be Input
not input
Declaration in config/app.php under aliases:-
'Input' => Illuminate\Support\Facades\Input::class,
Or You can import Input facade directly as required,
use Illuminate\Support\Facades\Input;
or
use Illuminate\Support\Facades\Input as input;
In Laravel 5.2 Input:: is replaced with Request::
use
Request::
Add to the top of Controller or any other Class
use Illuminate\Http\Request;