29 lines
627 B
PHP
29 lines
627 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use App\Models\Setting;
|
|
use Closure;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class View
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \Closure $next
|
|
* @return mixed
|
|
*/
|
|
public function handle($request, Closure $next)
|
|
{
|
|
view()->share('user', Auth::user());
|
|
view()->share('settingsArray', Setting::getSettingsAsArray());
|
|
$response = $next($request);
|
|
if($response->status() == 401) {
|
|
return redirect('/gui/login');
|
|
}
|
|
|
|
return $response;
|
|
}
|
|
}
|