It looks a bad idea to use one route for multiple actions (IMO) but... you may try something like this:
Route::get(
'{project}/{module?}/{submodule?}/{resources?}',
function($project, $module = null, submodule = null, $resources = null) {
if(!is_null($project)) {
$pc = App::make('ProjectController');
if(is_null($module)) return $pc->showProject($project);
else {
if(is_null($submodule)) return $pc->showModule($project, $module);
else {
if(!is_null($resources)) return $pc->showGraphsResources($project, $module, $submodule, $resources);
}
}
}
}
);
Now in your ProjectController
create three methods like this:
class ProjectController extends BaseController {
public function showProject($project)
{
//...
}
public function showModule($project, $module)
{
//...
}
public function showGraphsResources($project, $module, $submodule, $resources)
{
//...
}
}
Alternatively you may use only one missingMethod
to catch all methods in a controller, for example:
class ProjectController extends BaseController {
public function missingMethod($args = array())
{
// Now check the $args passed,
// depending on the $args you
// may take an action, try dd($args)
}
}