Skip to content

Commit 637d78f

Browse files
committed
Support a SiteValetDriver in the site path
1 parent ef1b5f1 commit 637d78f

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

cli/drivers/ValetDriver.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ abstract public function frontControllerPath($sitePath, $siteName, $uri);
4242
*/
4343
public static function assign($sitePath, $siteName, $uri)
4444
{
45-
$drivers = static::driversIn(VALET_HOME_PATH.'/Drivers');
45+
$drivers = [];
46+
47+
if ($customSiteDriver = static::customSiteDriver($sitePath)) {
48+
$drivers[] = $customSiteDriver;
49+
}
50+
51+
$drivers = array_merge($drivers, static::driversIn(VALET_HOME_PATH.'/Drivers'));
4652

4753
$drivers[] = 'LaravelValetDriver';
4854

@@ -71,6 +77,23 @@ public static function assign($sitePath, $siteName, $uri)
7177
}
7278
}
7379
}
80+
81+
/**
82+
* Get the custom driver class from the site path, if one exists.
83+
*
84+
* @param string $sitePath
85+
* @return string
86+
*/
87+
public static function customSiteDriver($sitePath)
88+
{
89+
if (! file_exists($sitePath.'/SiteValetDriver.php')) {
90+
return;
91+
}
92+
93+
require_once $sitePath.'/SiteValetDriver.php';
94+
95+
return 'SiteValetDriver';
96+
}
7497

7598
/**
7699
* Get all of the driver classes in a given path.

0 commit comments

Comments
 (0)