Skip to content

Instantly share code, notes, and snippets.

@itwondersteam
Last active March 4, 2021 11:21
Show Gist options
  • Save itwondersteam/bb505b0f00131dbb366fca7c2a0aefbc to your computer and use it in GitHub Desktop.
Save itwondersteam/bb505b0f00131dbb366fca7c2a0aefbc to your computer and use it in GitHub Desktop.
laravel tap
// 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