This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccount/app/Http/Middleware/View.php
2019-04-28 14:49:10 +02:00

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;
}
}