28 lines
585 B
PHP
28 lines
585 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Middleware;
|
||
|
|
|
||
|
|
use App\Traits\ResponseTrait;
|
||
|
|
use Closure;
|
||
|
|
|
||
|
|
class Customer
|
||
|
|
{
|
||
|
|
use ResponseTrait;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Handle an incoming request.
|
||
|
|
*
|
||
|
|
* @param \Illuminate\Http\Request $request
|
||
|
|
* @return mixed
|
||
|
|
*/
|
||
|
|
public function handle($request, Closure $next)
|
||
|
|
{
|
||
|
|
// Check if the authenticated user is not a Customer
|
||
|
|
if (auth()->user()->user_type != 'Customer') {
|
||
|
|
return $this->responseError([], _lang('You are not authorized to access this feature!'), 403);
|
||
|
|
}
|
||
|
|
|
||
|
|
return $next($request);
|
||
|
|
}
|
||
|
|
}
|