diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index fc8a88c..b3199d2 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -4,7 +4,7 @@ namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\AuthenticatesUsers; - +use Illuminate\Support\Facades\Auth; class LoginController extends Controller { /* @@ -27,6 +27,14 @@ class LoginController extends Controller */ protected $redirectTo = '/home'; + public function redirectTo(){ + if(Auth::user()->puesto_id == 1){ + return '/home'; + }else{ + return '/mesero'; + } + } + /** * Create a new controller instance. * diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 3ba3d1b..acf1d9a 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -64,5 +64,6 @@ class Kernel extends HttpKernel 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 'adminType' => \App\Http\Middleware\CheckAdminType::class, + 'meseroType' => \App\Http\Middleware\CheckMeseroType::class, ]; } diff --git a/app/Http/Middleware/CheckMeseroType.php b/app/Http/Middleware/CheckMeseroType.php new file mode 100644 index 0000000..d3e75ae --- /dev/null +++ b/app/Http/Middleware/CheckMeseroType.php @@ -0,0 +1,25 @@ +puesto_id == 2){ + return $next($request); + }else{ + return back(); + } + } +} diff --git a/resources/views/Mesero/mesero.blade.php b/resources/views/Mesero/mesero.blade.php new file mode 100644 index 0000000..f7b6ceb --- /dev/null +++ b/resources/views/Mesero/mesero.blade.php @@ -0,0 +1,11 @@ + + + + + + Document + + +

Bienvenido Mesero

+ + \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 60ddcd8..e561534 100644 --- a/routes/web.php +++ b/routes/web.php @@ -36,6 +36,13 @@ Route::resource('trabajadores', TrabajadorController::class); Route::resource('autos', AutoController::class); }); + +Route::middleware(['auth','meseroType'])->group(function(){ + Route::get('/mesero/', function(){ + return view('Mesero.mesero'); + })->name('meseroHome'); +}); + /* Route::get('/usuarios', function () { return view('usuarios');