中のAuth ::路線()およびルート:: AUTH()の違いは何であるか、私はウェブルートでデフォルトと呼ばれるAuth::routes()
があることを発見しました。 Auth::routes()
とRoute::auth()
の違いをより明確にしたいと思います。私は<strong>laravel 5.4</strong>で作業を開始しているlaravel
0
A
答えて
3
Auth::routes()
またはRoute::auth()
を使用すると同等です。
$app->make('router')
ちょうどない
Route
ファサードよう
Illuminate\Routing\Router
インスタンスを返し
/**
* Register the typical authentication routes for an application.
*
* @return void
*/
public static function routes()
{
static::$app->make('router')->auth();
}
:Auth::routes()
Infactはとして定義されます。 Illuminate\Routing\Router.php
に見られるような
1
Route::auth()
は(次のルートを作成します。あなたが見ることができるように、第二の
/**
* Register the typical authentication routes for an application.
*
* @return void
*/
public static function routes()
{
static::$app->make('router')->auth();
}
:
/**
* Register the typical authentication routes for an application.
*
* @return void
*/
public function auth()
{
// Authentication Routes...
$this->get('login', 'Auth\[email protected]')->name('login');
$this->post('login', 'Auth\[email protected]');
$this->post('logout', 'Auth\[email protected]')->name('logout');
// Registration Routes...
$this->get('register', 'Auth\[email protected]')->name('register');
$this->post('register', 'Auth\[email protected]');
// Password Reset Routes...
$this->get('password/reset', 'Auth\[email protected]')->name('password.request');
$this->post('password/email', 'Auth\[email protected]')->name('password.email');
$this->get('password/reset/{token}', 'Auth\[email protected]')->name('password.reset');
$this->post('password/reset', 'Auth\ResetPas[email protected]');
}
Auth::routes()
は、次の関数を(Illuminate\Support\Facades\Auth.php
に見られるような)を呼び出しますメソッドは、最初のRouter
クラスのインスタンスを作成し、auth()
関数を呼び出します。最後に、2つのメソッドに違いはありません。私は個人的にはRoute::auth()
を使ってアドバイスしています。それは "デフォルト"の実装のようです。
関連する問題
- 1. ロードオーバーレイJSFiddleで作業していて、Laravel
- 2. Laravelは、私は現在、ローカルホスト上で作業し、2つのlaravelのアプリを持っている
- 3. SFMLは、私が最近SFMLで作業を開始したスプライト
- 4. Laravelファイルのアップロードが私のフォームが動作しているが、私は、ファイルを追加するとき、Laravelは以下のページのダウンロードを開始ページ
- 5. Laravel whereBetweenクエリ誤っ作業
- 6. Laravel/Lumen:すべてを選択して開始する
- 7. FXyzライブラリで作業を開始する
- 8. codeigniterでSQLiteを使って作業を開始するには?
- 9. Laravel:あるsetLocale私はlaravel 5.1を使用してい
- 10. Laravel Connection停止した作業
- 11. laravelで作業しないで試してみてください5.4
- 12. Laravel 5.4私はlaravel 5.4で働いている
- 13. Laravel 5.2 ReflectionExceptionクラスlaravel-fullcalendarは、私はこのエラーを経験しています</p> <p>Laravel 5.ためFullcalendarパッケージを使用しています
- 14. Laravelプロジェクトは、私が成功したサーバーが、その動作していない上<strong>Laravel</strong>プロジェクトをインストールしている
- 15. gridViewの要素で作業を開始
- 16. NPMは、私は私が見つけたプロジェクトの作業を開始しようとしている
- 17. はセットアップLaravelプロジェクト私は、このコマンド</p> <pre><code>composer create-project laravel/laravel blog "5.1.*" </code></pre> <p>で作曲を使用してセットアップにlaravelプロジェクトを試す作曲
- 18. MongoPasswordFieldのsetPassword +私はリフト+スカラ+ mongorecordで少し作業を開始しました
- 19. 私はLaravel 5.3でLaravel 5.3
- 20. Laravelのエクスポートは、サーバー上で作業していて、以下のlocalhostの
- 21. は、私は私のlaravelコントローラ内の関数のコードを次しているlaravel
- 22. 私はアンドロイドで作業を始めていアンドロイド
- 23. 私はちょうど今日FlickrのAPIでの作業を開始し、私が質問していFlickrの
- 24. トランザクションの開始または作業の開始
- 25. 私はlaravel 5.5での作業と私はAJAXでそれを使用してのDataTableとIMを実装アヤックス
- 26. Laravel通知は、私が<a href="https://laravel-news.com/send-tweets-laravel-notifications" rel="nofollow noreferrer">Automatically Send Tweets through Laravel Notifications</a>を使用してい
- 27. Laravel 4:シードでの関係を使って作業する
- 28. laravelのMPDFは:niklasravnsborg/laravel-PDFライブラリを使用して、私はPDFファイルを作成しようとしている
- 29. Laravelチームワークは、私はチームワークモジュールでLaravel 5.4を使用しているアカウント
- 30. GAを使用して作業を開始する方法