Code cleanup, no functional changes
This commit is contained in:
@@ -8,43 +8,43 @@ use Illuminate\Contracts\Auth\Authenticatable;
|
||||
|
||||
class AddUserToView
|
||||
{
|
||||
/**
|
||||
* The View Factory.
|
||||
*
|
||||
* @var \Illuminate\Contracts\View\Factory
|
||||
*/
|
||||
protected Factory $factory;
|
||||
/**
|
||||
* The View Factory.
|
||||
*
|
||||
* @var \Illuminate\Contracts\View\Factory
|
||||
*/
|
||||
protected Factory $factory;
|
||||
|
||||
/**
|
||||
* The Authenticated user, if any.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Auth\Authenticatable|null
|
||||
*/
|
||||
protected ?Authenticatable $user;
|
||||
/**
|
||||
* The Authenticated user, if any.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Auth\Authenticatable|null
|
||||
*/
|
||||
protected ?Authenticatable $user;
|
||||
|
||||
/**
|
||||
* Create a new Share Authenticated User instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\View\Factory $factory
|
||||
* @param \Illuminate\Contracts\Auth\Authenticatable|null $user
|
||||
*/
|
||||
public function __construct(Factory $factory,Authenticatable $user=NULL)
|
||||
{
|
||||
$this->factory = $factory;
|
||||
$this->user = $user;
|
||||
}
|
||||
/**
|
||||
* Create a new Share Authenticated User instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\View\Factory $factory
|
||||
* @param \Illuminate\Contracts\Auth\Authenticatable|null $user
|
||||
*/
|
||||
public function __construct(Factory $factory,Authenticatable $user=NULL)
|
||||
{
|
||||
$this->factory = $factory;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$this->factory->share('user',$this->user);
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$this->factory->share('user',$this->user);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user