mardi 21 juillet 2020

Laravel: Method Illuminate\Auth\SessionGuard::claims does not exist

I want to install a Laravel package to create an editor for H5P contents (e-learning modules based on JavaScript). There's not much documentation for the package. It's composer.json requires Laravel 5.8, so I started with a fresh Laravel 5.8.35 app, ran php artisan make:auth and installed the package.

Now I need to open the page /library, but I get an error:

BadMethodCallException
Method Illuminate\Auth\SessionGuard::claims does not exist.

This error is caused by /vendor/exatech-group/laravel-h5p/src/LaravelH5p/LaravelH5p.php, which contains several calls to a claims() method:

$settings = [
  'baseUrl'            => config('laravel-h5p.domain'),
  'url'                => config('laravel-h5p.domain').'/api/h5p_protect?'.(Auth::check() ? 'token='.auth()->claims(['referer' => app('Illuminate\Routing\UrlGenerator')->previous()])->tokenById(Auth::id()).'&' : '').'data=',
  'postUserStatistics' => (config('laravel-h5p.h5p_track_user', true) === '1') && Auth::check(),
  'ajax'               => [
    'setFinished'     => route('h5p.ajax.finish').(Auth::check() ? '?token='.auth()->claims(['referer' => app('Illuminate\Routing\UrlGenerator')->previous()])->tokenById(Auth::id()) : ''),
    'contentUserData' => route('h5p.ajax.content-user-data').'?content_id=:contentId&data_type=:dataType&sub_content_id=:subContentId'.(Auth::check() ? '&token='.auth()->claims(['referer' => app('Illuminate\Routing\UrlGenerator')->previous()])->tokenById(Auth::id()) : ''),
  ],
  // a few more elements
]

I can't find any info on this method. How is this supposed to work, is there a specific Laravel version that contains it or is there anything I missed to install?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2OJ6T8K
via IFTTT

Aucun commentaire:

Enregistrer un commentaire