init project
This commit is contained in:
34
app/Http/Middleware/VerifyBaseLab.php
Normal file
34
app/Http/Middleware/VerifyBaseLab.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
//use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class VerifyBaseLab
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param Closure $next
|
||||
* @return string|null
|
||||
*/
|
||||
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
try{
|
||||
if (!$request->session()->exists('base_lab_id')) {
|
||||
return redirect('/base');
|
||||
}
|
||||
} catch (\Exception $e){
|
||||
|
||||
Log::error($e);
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user