Skip to content

Instantly share code, notes, and snippets.

@tliesnham
Last active August 10, 2017 14:02
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tliesnham/4a60add079a083a7e0198b1f05e49664 to your computer and use it in GitHub Desktop.
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.
<?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';
}
}
@unrivaledcreations
Copy link

Worked like a champ! I copied this file into my ~/.valet/Drivers folder, then ran valet restart to fix the 404 Coaster responsive file manager error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment