LoginSignup
0
0

More than 5 years have passed since last update.

Laravel5の認証コントローラー内でミドルウェアを設定

Posted at

認証は管理者向けなので、特定のユーザーはマイグレーションで登録済み。

ユーザー登録をログインした状態でのみ許可したい。

Http/Controllers/Auth/AuthController.php
public function __construct(Guard $auth, Registrar $registrar)
    {
        $this->auth = $auth;
        $this->registrar = $registrar;

        $this->middleware('guest', ['except' => ['getLogout', 'getRegister', 'postRegister']]);
        $this->middleware('auth', ['only' => ['getRegister', 'postRegister']]);
    }

ルーティングの変更は以下で確認。

artisan route:list
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