0
0

More than 3 years have passed since last update.

laravel8 Auth認証をしていないと表示できないページを作成する

Posted at

目的

  • Auth認証を行っていないと表示できないページを実装する方法をまとめる

方法

  • ルーティングに記載するだけで実装が可能である。
  • 下記のようなルーティング情報が記載されていたとする。

    アプリ名ディレクトリ/routes/web.php
    Route::get('/top', [TopController::class, 'index'])->name('top.index');
    
  • 下記のように記載することで当該ページが認証していないと表示できないページにする事ができる。

    アプリ名ディレクトリ/routes/web.php
    Route::get('/top', [TopController::class, 'index'])->middleware(['auth'])->name('top.index');
    
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0