- Removed `UserDashboardController` and related user dashboard views. - Introduced `ExplorePageController` and redesigned `explore.blade.php` as the main user-facing page. - Updated routing logic to redirect users (non-admin and non-broker) to the `explore` page. - Added dedicated sidebar and layout components for the broker dashboard, improving structure and navigation.
25 lines
546 B
PHP
25 lines
546 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Illuminate\Http\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
class HasRole
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
|
*/
|
|
public function handle(Request $request, Closure $next, ...$roles): Response
|
|
{
|
|
if (in_array($request->user()->role, $roles)) {
|
|
return $next($request);
|
|
} else {
|
|
abort('401');
|
|
}
|
|
}
|
|
}
|