-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
LocalValetDriver.win.php
46 lines (37 loc) · 1.41 KB
/
LocalValetDriver.win.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
42
43
44
45
46
<?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 $this->convertForWindows($sitePath.$public.$wpslug.'/wp-admin/index.php');
}
return $this->convertForWindows($sitePath.$public.$uri);
}
if (str_contains($uri, 'wp-login.php')) {
return $this->convertForWindows($sitePath.$public.$wpslug.'/wp-login.php');
}
return $this->convertForWindows($sitePath.$public.$wpslug.'/index.php');
}
return $this->convertForWindows($sitePath.$public.'/index.php');
}
public function convertForWindows($url)
{
return str_replace('/', '\\', $url);
}
}