Created
May 15, 2018 23:53
-
-
Save whoisryosuke/eba07bfc894a2625898fcba0510542b9 to your computer and use it in GitHub Desktop.
Laravel - Apply Middleware in the Controller to "only" certain methods, or "except" certain methods.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function __construct() | |
{ | |
// Only apply middleware to these methods | |
$this->middleware('auth', ['only' => ['create', 'store', 'edit', 'delete']]); | |
// Or exclude middleware from these methods | |
$this->middleware('auth', ['except' => ['confirmPage', 'confirmOrder', 'invoice']]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment