I have created new guard and trying to implement on routes but it is not working but when i try to implement it in controller it works fine. On routes it gives too many redirection error
routes
// Route::group(['middleware' => ['trading_partner']], function () {
Route::group(['prefix' => 'tradingpartners'], function () {
//contractor auth controller
Route::get('/login', 'ContractorAuth\ContractorAuthController@getLogin')->name('contractors.login');
Route::post('/login', 'ContractorAuth\ContractorAuthController@postLogin')->name('contractors.login');
Route::post('/logout', 'ContractorAuth\ContractorAuthController@postLogout')->name('contractors.logout');
//user contractor contorller
Route::get('/dashboard', 'User\ContractorController@contractorDashboard')->name('contractors.dashboard');
Route::get('/dashboard/pallets_balance_report_table', 'User\ContractorController@palletsBalanceReportTable');
});
// });
controller
class TradingPartnerAuthController extends Controller
{
use AuthenticatesUsers;
protected $guardName = 'trading_partner';
protected $maxAttempts = 3;
protected $decayMinutes = 2;
protected $loginRoute;
public function __construct()
{
$this->middleware('guest:trading_partner', ['except' => ['logout', 'postLogout']]);
$this->loginRoute = route('trading_partners.login');
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire