Authentication

Admin login, session-based auth, password reset, and profile/session management.

How it works

The admin panel uses Laravel's session-based authentication. Unauthenticated visitors hitting /admin/* are redirected to the login page. Authenticated requests must pass the admin.auth middleware, which validates the session and loads the current user (with roles eager-loaded).

Login flow

RouteMethodPurpose
/admin/loginGETShow login form
/admin/loginPOSTAuthenticate (email + password). Optional "remember me".
/admin/logoutPOSTDestroy session and redirect to login
/GETRedirects to /admin/login

Validation

Security

Profile management

Each admin can manage their own profile, avatar, password, and active sessions.

RouteMethodPurpose
/admin/profileGETShow the current user's profile
/admin/profilePUTUpdate name, email, avatar upload
/admin/profile/avatarDELETERemove avatar
/admin/profile/passwordPUTChange password (requires current password)
/admin/profile/sessions/revokePOSTRevoke all other active sessions

Authorization

Permissions are role-based. Each role stores a JSON permission map (roles.permissions), and the User model exposes a can($ability) helper that checks all of the user's roles. Permissions are enforced in controllers and Blade views via gates.

Where to lookapp/Http/Controllers/Admin/AuthController.php, app/Http/Controllers/Admin/ProfileController.php, app/Http/Middleware/AdminAuth.php.

Initial credentials

After running php artisan migrate:fresh --seed, a default admin user is created by the seeder. Check database/seeders/ for the credentials in your environment.