Skip to content

Commit 26d39ae

Browse files
committed
Merge branch 'master' of https://github.com/jasonvarga/valet into jasonvarga-master
2 parents 5a25224 + 637d78f commit 26d39ae

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

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

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

0 commit comments

Comments
 (0)