mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 08:30:07 +01:00
Support a SiteValetDriver in the site path
This commit is contained in:
@@ -42,7 +42,13 @@ abstract public function frontControllerPath($sitePath, $siteName, $uri);
|
||||
*/
|
||||
public static function assign($sitePath, $siteName, $uri)
|
||||
{
|
||||
$drivers = static::driversIn(VALET_HOME_PATH.'/Drivers');
|
||||
$drivers = [];
|
||||
|
||||
if ($customSiteDriver = static::customSiteDriver($sitePath)) {
|
||||
$drivers[] = $customSiteDriver;
|
||||
}
|
||||
|
||||
$drivers = array_merge($drivers, static::driversIn(VALET_HOME_PATH.'/Drivers'));
|
||||
|
||||
$drivers[] = 'LaravelValetDriver';
|
||||
|
||||
@@ -71,6 +77,23 @@ public static function assign($sitePath, $siteName, $uri)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the custom driver class from the site path, if one exists.
|
||||
*
|
||||
* @param string $sitePath
|
||||
* @return string
|
||||
*/
|
||||
public static function customSiteDriver($sitePath)
|
||||
{
|
||||
if (! file_exists($sitePath.'/SiteValetDriver.php')) {
|
||||
return;
|
||||
}
|
||||
|
||||
require_once $sitePath.'/SiteValetDriver.php';
|
||||
|
||||
return 'SiteValetDriver';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the driver classes in a given path.
|
||||
|
||||
Reference in New Issue
Block a user