- Implemented dashboard view with vehicle stats, active services, recent activity, and upcoming appointments. - Created estimates view with filtering options and a list of service estimates. - Developed invoices view to manage service invoices and payment history with filtering. - Added vehicles view to display registered vehicles and their details. - Built work orders view to track the progress of vehicle services with filtering and detailed information.
32 lines
680 B
PHP
32 lines
680 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Illuminate\Http\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
class AdminOnly
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*/
|
|
public function handle(Request $request, Closure $next): Response
|
|
{
|
|
$user = auth()->user();
|
|
|
|
if (!$user) {
|
|
return redirect('/login');
|
|
}
|
|
|
|
// Check if user has customer role
|
|
if ($user->isCustomer()) {
|
|
// Customer accounts should only access customer portal
|
|
return redirect('/customer-portal');
|
|
}
|
|
|
|
// Allow admin/staff users to continue
|
|
return $next($request);
|
|
}
|
|
}
|