Are you accessing the same routes from the mobile as from the desktop? Any chance you missed to add this middleware to the routes used by the mobile?
Nov 25, 2019
3
Level 1
Middleware not working after change config to detect view using Agent
Middleware share variable not working after i change to mobile view.
Every time call a specific route checking the middleware and share a variable from there using
View::share('count', $count);
I change my view.php in config directory as shown below
<?php
$viewBasePath = realpath(base_path('resources/views'));
$viewsPaths = [$viewBasePath];
$agent = new Jenssegers\Agent\Agent();
if ($agent->isMobile()) {
array_unshift($viewsPaths, $viewBasePath.'/mobile');
}
return [
'paths' => $viewsPaths
...
It works fine for web, but when i deploy to my mobile it show undefined variable count? Anything i missed out?
Please or to participate in this conversation.