Middleware se encarga de validar que usuario pertenezca al restaurant

This commit is contained in:
2021-07-20 02:03:29 -04:00
parent 3534fdd02a
commit 6a7e08478f
9 changed files with 112 additions and 86 deletions

View File

@@ -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);