UserLoginController.php
This is login controller to redirect to homepage after verifying username and password.
public function userLogin(UserLoginRequest $request){
// return view('welcome');
// echo "Login Page";
$input = Input::all();
$data = User::get(['name','password'])->where('name',$input['name'])
->where('password',$input['password']);
$datas = collect($data);
//What should I do here for matching username and password and redirect to another page.
dd($datas);
}
Output:This is the output after dumping variabl $datas
Collection {#157 ▼
#items: array:1 [▼
0 => User {#187 ▼
#fillable: array:3 [▶]
#hidden: array:2 [▶]
#connection: null
#table: null
#primaryKey: "id"
#keyType: "int"
#perPage: 15
+incrementing: true
+timestamps: true
#attributes: array:2 [▼
"name" => "girdhari013"
"password" => "girdhari@"
]
#original: array:2 [▼
"name" => "girdhari013"
"password" => "girdhari@"
]
#relations: []
#visible: []
#appends: []
#guarded: array:1 [▶]
#dates: []
#dateFormat: null
#casts: []
#touches: []
#observables: []
#with: []
#morphClass: null
+exists: true
+wasRecentlyCreated: false
}
]
}
routes.php
// This is to redirect after clicking on submit button.
Route::any('/login-verify',[
'uses' => 'UserLoginController@userLogin',
'as' => 'login.form'
]);
via Giridhari Lal