27 lines
509 B
PHP
27 lines
509 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class AuthBasic
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \Closure $next
|
|
* @return mixed
|
|
*/
|
|
public function handle($request, Closure $next)
|
|
{
|
|
if(Auth::onceBasic()){
|
|
return response()->json(["message " => "Auth failed."], 404);
|
|
}
|
|
else{
|
|
return $next($request);
|
|
}
|
|
}
|
|
}
|