Mejoras generales .w. se me olvida que agrego

This commit is contained in:
2021-07-20 00:36:50 -04:00
parent 19207b89f6
commit 7fa39a8b11
9 changed files with 88 additions and 18 deletions

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Exceptions;
use Exception;
class NotAuthorizedException extends Exception {
protected $user;
public function __construct($user) {
$this->user = $user;
}
public function render($request) {
$path = $request->getPathInfo();
return response()->json([
'error' => 'not_authorized',
'message' => 'El usuario ' . $this->user->id . ' no tiene permiso para acceder al endpoint ' . $path
], 401);
}
}