I have created a roles and group table:
Group : Car Role : Owner,Customer,Agent.
I have table where I include above things :
Group table
Role table
Role Group Mapping table
I have login screen in laravel default I just change a login layout using show_login() override a method. I want to implement role base login. Views are restricted to role (Owner,Agent,Customer).
Login Controller:
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/dashboard';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
public function showLoginForm()
{
return view('customlogin');
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire