Last active
August 10, 2017 14:02
-
-
Save tliesnham/4a60add079a083a7e0198b1f05e49664 to your computer and use it in GitHub Desktop.
Fixes the Responsive Filemanager when running a Coaster project locally with Laravel Valet.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CoasterValetDriver extends ValetDriver | |
{ | |
/** | |
* Determine if the driver serves the request. | |
* | |
* @param string $sitePath | |
* @param string $siteName | |
* @param string $uri | |
* @return void | |
*/ | |
public function serves($sitePath, $siteName, $uri) | |
{ | |
return is_dir($sitePath.'/public/coaster'); | |
} | |
/** | |
* Determine if the incoming request is for a static file. | |
* | |
* @param string $sitePath | |
* @param string $siteName | |
* @return string|false | |
*/ | |
public function isStaticFile($sitePath, $siteName, $uri) | |
{ | |
if (file_exists($staticFilePath = $sitePath.'/public'.$uri)) { | |
return $staticFilePath; | |
} | |
return false; | |
} | |
/** | |
* Get the fully resolved path to the application's front controller. | |
* | |
* @param string $sitePath | |
* @param string $siteName | |
* @param string $uri | |
* @return string | |
*/ | |
public function frontControllerPath($sitePath, $siteName, $uri) | |
{ | |
if (strpos($uri, '/coaster/filemanager') !== false) { | |
return $sitePath.'/public'.$uri; | |
} | |
return $sitePath.'/public/index.php'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Worked like a champ! I copied this file into my
~/.valet/Drivers
folder, then ranvalet restart
to fix the 404 Coaster responsive file manager error.