Merge pull request #7507 from CirkaN/Cirkovic/INA-7

INA-7 | Add Vendor guard
This commit is contained in:
David Bomba 2022-06-12 17:13:26 +10:00 committed by GitHub
commit 7658c66953
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 63 additions and 20 deletions

View File

@ -39,6 +39,12 @@ class RedirectIfAuthenticated
// return redirect()->route('dashboard.index');
// }
break;
case 'vendor':
if (Auth::guard($guard)->check()) {
//TODO create routes for vendor
// return redirect()->route('vendor.dashboard');
}
break;
default:
Auth::logout();
// if (Auth::guard($guard)->check()) {

View File

@ -121,4 +121,12 @@ class RouteServiceProvider extends ServiceProvider
->namespace($this->namespace)
->group(base_path('routes/shop.php'));
}
protected function mapVendorsApiRoutes()
{
Route::prefix('')
->middleware('vendor')
->namespace($this->namespace)
->group(base_path('routes/vendor.php'));
}
}

View File

@ -56,6 +56,10 @@ return [
'driver' => 'session',
'provider' => 'contacts',
],
'vendor' => [
'driver' => 'session',
'provider' => 'vendors',
],
],
/*
@ -85,6 +89,11 @@ return [
'driver' => 'eloquent',
'model' => App\Models\ClientContact::class,
],
'vendors' => [
'driver' => 'eloquent',
'model' => App\Models\VendorContact::class,
],
// 'users' => [
// 'driver' => 'database',
@ -120,6 +129,11 @@ return [
'table' => 'password_resets',
'expire' => 60,
],
'vendors' => [
'provider' => 'vendors',
'table' => 'password_resets',
'expire' => 60,
],
],
/*

15
routes/vendor.php Normal file
View File

@ -0,0 +1,15 @@
<?php
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/