Last active
March 4, 2021 11:21
-
-
Save itwondersteam/bb505b0f00131dbb366fca7c2a0aefbc to your computer and use it in GitHub Desktop.
laravel tap
This file contains hidden or 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
// https://laravel-news.com/using-sanctum-to-authenticate-a-react-spa | |
// The tap command is a short-hand way of saying “create the guard, then pass it to the closure in the second argument; | |
// then return the guard”. Let’s look at createGuard: | |
$auth->extend('sanctum', function ($app, $name, array $config) use ($auth) { | |
return tap($this->createGuard($auth, $config), function ($guard) { | |
$this->app->refresh('request', $guard, 'setRequest'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment