Authentication System Complete (50% of Phase 2): - Created Admin AuthController with login/logout - Created AdminAuth middleware for session-based auth - Registered middleware in bootstrap/app.php - Configured all admin routes with protection - Created 4 admin controller files (Dashboard, DocketEntry, Document, Subscriber) Session-based authentication: - Stores admin_id and admin_username in session - Middleware checks for admin_id presence - Separate from Laravel Breeze User auth - Uses AdminUser model with auto-hashing passwords Routes configured: - Public: GET/POST /admin/login - Protected: /admin/dashboard, /admin/docket-entries (CRUD), /admin/documents, /admin/subscribers Remaining work (50%): - Implement controller logic (7 methods for DocketEntry, etc.) - Create 9 Vue admin pages (Login, Dashboard, CRUD forms) - Create AdminSeeder for default admin user - Configure file storage for PDF uploads - Test all admin features See cline_docs/phase2_progress.md for detailed next steps
25 lines
569 B
PHP
25 lines
569 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Session;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
class AdminAuth
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
|
*/
|
|
public function handle(Request $request, Closure $next): Response
|
|
{
|
|
if (!Session::has('admin_id')) {
|
|
return redirect()->route('admin.login');
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
}
|