1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-05 08:30:07 +01:00

Merge pull request #310 from scottwakefield/master

Add support for Craft 3 Beta
This commit is contained in:
Adam Wathan
2017-03-11 09:59:02 -05:00
committed by GitHub

View File

@@ -12,7 +12,18 @@ class CraftValetDriver extends ValetDriver
*/
public function serves($sitePath, $siteName, $uri)
{
return is_dir($sitePath.'/craft');
return file_exists($sitePath.'/craft');
}
/**
* Determine the name of the directory where the front controller lives.
*
* @param string $sitePath
* @return string
*/
public function frontControllerDirectory($sitePath)
{
return is_file($sitePath.'/craft') ? 'web' : 'public';
}
/**
@@ -25,7 +36,9 @@ public function serves($sitePath, $siteName, $uri)
*/
public function isStaticFile($sitePath, $siteName, $uri)
{
if ($this->isActualFile($staticFilePath = $sitePath.'/public'.$uri)) {
$frontControllerDirectory = $this->frontControllerDirectory($sitePath);
if ($this->isActualFile($staticFilePath = $sitePath.'/'.$frontControllerDirectory.$uri)) {
return $staticFilePath;
}
@@ -42,8 +55,10 @@ public function isStaticFile($sitePath, $siteName, $uri)
*/
public function frontControllerPath($sitePath, $siteName, $uri)
{
$frontControllerDirectory = $this->frontControllerDirectory($sitePath);
// Default index path
$indexPath = $sitePath.'/public/index.php';
$indexPath = $sitePath.'/'.$frontControllerDirectory.'/index.php';
$scriptName = '/index.php';
// Check if the first URL segment matches any of the defined locales