Middleware se encarga de validar que usuario pertenezca al restaurant
This commit is contained in:
@@ -7,17 +7,16 @@ use Illuminate\Support\Facades\Log;
|
||||
|
||||
class LogEndpointHitMiddleware {
|
||||
public function handle($request, Closure $next) {
|
||||
$userId = $request->user ? $request->user->id : null;
|
||||
$user = $request->user;
|
||||
$method = $request->getMethod();
|
||||
$path = $request->getPathInfo();
|
||||
|
||||
Log::debug('User ' . $userId . ' hitting ' . $method . ' ' . $path . ' endpoint', [
|
||||
'user' => $userId,
|
||||
Log::debug('User ' . $user->id . ' hitting ' . $method . ' ' . $path . ' endpoint', [
|
||||
'user' => $user->id,
|
||||
'roles' => implode('|', $user->roles),
|
||||
'method' => $method,
|
||||
'path' => $path,
|
||||
'input' => array_filter($request->input(), function ($key) {
|
||||
return $key !== 'user';
|
||||
}, ARRAY_FILTER_USE_KEY)
|
||||
'input' => array_filter($request->input(), function ($key) { return $key !== 'user'; }, ARRAY_FILTER_USE_KEY)
|
||||
]);
|
||||
|
||||
return $next($request);
|
||||
|
||||
Reference in New Issue
Block a user