2017-02-06 1 views
0

したがって、単一のコントローラとメソッドを呼び出すAPIエンドポイント/api/v1/xxxがあります。私はcomposer installを実行する場合を除きLaravel 5.4:ログインしたユーザーまたはログアウトしたユーザーに基づいてルートを作成する最良の方法

if (Auth::guard('api')->guest()) { 
    Route::post('xxx', 'API\v1\[email protected]'); 
} else { 
    Route::post('xxx', 'API\v1\[email protected]')->middleware('auth:api'); 
} 

すべての作品次のロジックを追加したroutes/api.php

は、私は次のエラーを取得:

[email protected] /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 

routes/api.phpで行を削除すると、出力しないこと^ composer installを実行するとエラーが発生します。

私は間違っていますか?

ありがとうございました。

答えて

0

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

これ以上の行はすべてが、あなたがlaravel/passportをインストールして有効にしていると言うが、あなたは鍵を生成することを忘れ、

runコマンド

php artisan passport:install 

、それだけで正常に動作します。

+0

このルートを有効にしてphp artisanコマンドを実行することはできません。 – Phantom007

+0

これはもっと簡単です。これらの行をコメントし、php artisan passportを実行します。インストールして、これらの行のコメントを外してコンポーザーをインストールします。 – rummykhan

+0

私はこれが可能な解決策であるとは思わない。その多くは「ジャガード」だ。 – Phantom007

関連する問題