add nova
This commit is contained in:
39
nova/src/AuthorizesRequests.php
Normal file
39
nova/src/AuthorizesRequests.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Nova;
|
||||
|
||||
trait AuthorizesRequests
|
||||
{
|
||||
/**
|
||||
* The callback that should be used to authenticate Nova users.
|
||||
*
|
||||
* @var (\Closure(\Illuminate\Http\Request):(bool))|null
|
||||
*/
|
||||
public static $authUsing;
|
||||
|
||||
/**
|
||||
* Register the Nova authentication callback.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request):bool $callback
|
||||
* @return static
|
||||
*/
|
||||
public static function auth($callback)
|
||||
{
|
||||
static::$authUsing = $callback;
|
||||
|
||||
return new static;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given request can access the Nova dashboard.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return bool
|
||||
*/
|
||||
public static function check($request)
|
||||
{
|
||||
return (static::$authUsing ?: function () {
|
||||
return app()->environment('local');
|
||||
})($request);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user