I want to make sure this two is connecting with a variable. Which the variable determine during login: ROLE. The user will only can view information who work under them only.
LoginController.php
protected function authenticated($request, $user)
{
if($user->role == 'workers') {
$this->redirectTo = ('/home');
} else if($user->role == 'manager') {
$this->redirectTo = ('/welcome');
} else {//($user->role = 'admin')
$this->redirectTo = ('/dashboard');
}
return redirect()->intended($this->redirectPath());
}
AttendanceController.php
class AttendanceViewController extends Controller
{
protected function index()
{
$attendance1 = DB::select('select * from attendance where line_num = "$role"');
return view('attendanceview',['attendance1'=>$attendance1]);
}
}
I have tried the suggestion from our friends: Session & Authorization it seems to work but it does not appear the information that I want in the AttendanceController.