lundi 6 février 2017

Laravel 5.4: What is the best way to create routes based on user logged in or logged out

So, I have an api endpoint /api/v1/xxx that calls a single controller and method.

In the routes/api.php I have added the following logic

if (Auth::guard('api')->guest()) {
    Route::post('xxx', 'API\v1\XXController@xx');
} else {
    Route::post('xxx', 'API\v1\XXController@xx')->middleware('auth:api');
}

Everything works except when I run composer install, i get the following error:

a@b /var/www/html/test/app13 $ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize


  [LogicException]                                                             
  Key path "file:///var/www/html/test/app13/storage/oauth-public.key" does not exist or is not readable                                                   


Script php artisan optimize handling the post-install-cmd event returned with error code 1

Removing the lines in routes/api.php does not output that ^ error when i run composer install.

What am i doing wrong?

Thanks for any help.



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

Aucun commentaire:

Enregistrer un commentaire