Hello!
Explanation
As the fire command used in php artisan serve command uses your laravel/application instance to change to the public folder (with chdir) and it returns an Exception because the folder does not exist in your base directory.
Illuminate\Foundation\Console\ServeCommand
...
public function fire()
{
// This changes the work directory. Accessing method publicPath in Class Illuminate\Foundation\Application
chdir($this->laravel->publicPath());
...
}
...
Illuminate\Foundation\Application
class Application extends Container implements ApplicationContract, HttpKernelInterface
{
...
public function publicPath()
{
return $this->basePath.DIRECTORY_SEPARATOR.'public';
}
...
}
Possible Solution
One of the alternatives is extending the Illuminate\Foundation\Application and overwrite the method publicPath() in your new application Class (Tested with Laravel 5.1).
You can create a new file for in your app folder for example app/MyApplication.php extending Illuminate\Foundation\Application
<?php namespace App;
use Illuminate\Foundation\Application;
class MyApplication extends Application
{
public function publicPath()
{
// Your new public path
return realpath($this->basePath . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'public');
}
}
After this you only need to change the Class to create your app in bootstrap/app.php
// Replace this
/*$app = new Illuminate\Foundation\Application(
realpath(__DIR__ . '/../')
);*/
$app = new \App\MyApplication(
realpath(__DIR__ . '/../')
);
Hope it helps!
Regards
Tiago Tavares