agent
agent copied to clipboard
not working in middleware
this code not working in middleware
public function handle($request, Closure $next)
{
$agent = new Agent();
if ($agent->isMobile()) {
return $next($request);
}
return response(['erorr' => 'Access denied'], 403);
}
when i use in middleware $agent is null
I do not know if you already solved your issue, but to those who are also experiencing malfunctioning, try to import the component in your code using use Jenssegers\Agent\Agent;
instead of just use Agent;
.
This is a known problem, but I can't find the original issue.
I do not know if you already solved your issue, but to those who are also experiencing malfunctioning, try to import the component in your code using
use Jenssegers\Agent\Agent;
instead of justuse Agent;
. This is a known problem, but I can't find the original issue.
not working still with this import