Got the mobile route to work
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Jenssegers\Agent\Facades\Agent;
|
||||
|
||||
class DetectorServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Response::macro("detect", function ($view, $args) {
|
||||
if(Agent::isMobile()) {
|
||||
return view(config("detector.mobilePath") . "." . $view, $args);
|
||||
}
|
||||
return view(config("detector.defaultPath") . "." . $view, $args);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user