StudentLoginController.php
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class StudentLoginController extends Controller
{
use AuthenticatesUsers;
protected $redirectTo = '/student/dashboard';
public function __construct()
{
$this->middleware('guest')->except('logout');
}
public function showLoginForm()
{
return view('auth.student-login');
}
protected function guard()
{
return Auth::guard('student');
}
}
web.php
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Auth\StudentLoginController;
use App\Http\Controllers\Auth\DeanLoginController;
Route::get('/', function () {
return view('welcome');
});
// Маршруты для входа студента
Route::get('/login/student', [StudentLoginController::class, 'showLoginForm'])->name('student.login');
Route::post('/login/student', [StudentLoginController::class, 'login'])->name('student.login.submit');
// Маршруты для входа декана
Route::get('/login/dean', [DeanLoginController::class, 'showLoginForm'])->name('dean.login');
Route::post('/login/dean', [DeanLoginController::class, 'login'])->name('dean.login.submit');
Скриншот фрагмента кода удалён модератором.