Dec 26, 2016
0
Level 1
Missing argument 1 for Illuminate\Support\Manager::createDriver() while using lumen 5.3
Got this error while creating a login api using lumen. Here is login function in LoginController.php
public function login(Request $request) {
$email = $request->get('email');
$password = $request->get('password');
$rules = array(
'email' => 'required|email',
'password' => 'required',
);
$validator = $request->all();
$validation = Validator::make($validator, $rules);
if ($validation->fails()) {
return response()->json([
'message' => $validation->errors(),
'status' => 401
]);
}
if (Auth::attempt(['email' => $email, 'password' => $password], true) === false) {
return response()->json([
'message' => 'Your username/password combination was incorrect',
'email' => $email,
'password' => $password,
'status' => 401
]);
}
if (Auth::attempt(['email' => $email, 'password' => $password], true) === true) {
return response()->json([
'message' => 'Login successful',
'username' => Auth::user()->name,
'id' => Auth::user()->id,
'status' => 200
]);
}
}
routes.php
$app->group(['prefix' => ''],function() use ($app){
$app->post('login', 'Auth\LoginController@login');
$app-post('forgetpassword','Auth\LoginController@forgetPassword');
});
I created config folder in root directory and create a file auth.php
<?php
return [
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
],
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
'table' => 'users'
],
],
'passwords' => [
//
],
];
I register this config file under bootstrap/app.php . Now when I hitting url in postman i got error. I debug error from my site error is coming from
`Auth::attempt(['email' => $email, 'password' => $password], true)=== false`
this line. Don't have any idea about this problem please help.
Please or to participate in this conversation.