witam robię system uprawnień z kursu https://www.itsolutionstuff.com/post/laravel-6-user-roles-and-permissions-from-scratch-laravel-6-aclexample.html
Step 11
Wywala mi ciągle bład przy seedowaniu. Po komędzie
php artisan make:seeder PermissionTableSeeder
wyskakuje mi poniższy błąd. Co może być problemem? plik Handler.php mam skompilowany tak jak w kursie.
Treść błedu:
$ php artisan make:seeder PermissionTableSeeder
PHP Fatal error: Declaration of App\Exceptions\Handler::report(Exception $exception) must be compatible with Illuminate\Foundation\Exceptions\Handler::report(Throwable $e) in C:\xampp\htdocs\Roles\blog\app\Exceptions\Handler.php on line 8
PHP Fatal error: Uncaught ReflectionException: Class App\Exceptions\Handler does not exist in C:\xampp\htdocs\Roles\blog\vendor\laravel\framework\src\Illuminate\Container\Container.php:803
Stack trace:
#0 C:\xampp\htdocs\Roles\blog\vendor\laravel\framework\src\Illuminate\Container\Container.php(803): ReflectionClass->__construct('App\\Exceptions\\...')
#1 C:\xampp\htdocs\Roles\blog\vendor\laravel\framework\src\Illuminate\Container\Container.php(681): Illuminate\Container\Container->build('App\\Exceptions\\...')
#2 C:\xampp\htdocs\Roles\blog\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(787): Illuminate\Container\Container->resolve('App\\Exceptions\\...', Array, false)
#3 C:\xampp\htdocs\Roles\blog\vendor\laravel\framework\src\Illuminate\Container\Container.php(265): Illuminate\Foundation\Application->resolve('App\\Exceptions\\...', Array, false)
#4 C:\xampp\htdocs\Roles\blog\vendor\laravel\framework\src\Illuminate\Container\Container.php(799): Illuminate\Container\Container->Illuminate\Container\{closure} in C:\xampp\htdocs\Roles\blog\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 805
Natomiast mój plik Handler.php poniżej. Co może być przyczyną tego błedu?
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* Report or log an exception.
*
* @param \Exception $exception
* @return void
*
* @throws \Exception
*/
public function report(Exception $exception)
{
parent::report($exception);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Exception
*/
public function render($request, Exception $exception)
{
if ($exception instanceof \Spatie\Permission\Exceptions\UnauthorizedException) {
return response()->json(['User have not permission for this page access.']);
}
return parent::render($request, $exception);
}
}