-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
LocalValetDriver.mac.php
41 lines (33 loc) · 1.19 KB
/
LocalValetDriver.mac.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
use Valet\Drivers\LaravelValetDriver;
class LocalValetDriver extends LaravelValetDriver
{
/**
* Determine if the driver serves the request.
*/
public function serves(string $sitePath, string $siteName, string $uri): bool
{
return true;
}
/**
* Get the fully resolved path to the application's front controller.
*/
public function frontControllerPath(string $sitePath, string $siteName, string $uri): ?string
{
$public = '/public';
$wpslug = '/wp';
if (str_contains($uri, $wpslug.'/') || str_ends_with($uri, $wpslug)) {
if (str_contains($uri, '/wp-admin')) {
if (str_ends_with($uri, '/wp-admin/') || str_ends_with($uri, '/wp-admin') || str_ends_with($uri, '/wp-admin/index.php')) {
return $sitePath.$public.$wpslug.'/wp-admin/index.php';
}
return $sitePath.$public.$uri;
}
if (str_contains($uri, 'wp-login.php')) {
return $sitePath.$public.$wpslug.'/wp-login.php';
}
return $sitePath.$public.$wpslug.'/index.php';
}
return $sitePath.$public.'/index.php';
}
}