redireccion basica
This commit is contained in:
1 parent
da8bd27d5f
commit
9ccbba14f1
5 files changed
+119
-124
No files matched your search
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\middlewares;
|
||||
|
||||
use flight\Engine;
|
||||
use Tracy\Debugger;
|
||||
|
||||
class DetectMobileDevice
|
||||
{
|
||||
protected Engine $app;
|
||||
|
||||
public function __construct(Engine $app)
|
||||
{
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
public function before(array $params): void
|
||||
{
|
||||
$userAgent = $this->app->request()->user_agent;
|
||||
|
||||
$is_apple = preg_match('/iPhone|iPad|iPod/i', $userAgent);
|
||||
|
||||
$this->app->set('is_apple', $is_apple);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user