Support the ongoing development of →
posted 10 years ago
Last updated 2 years ago.

Issue 1 is solved (more or less) with the following solution:

Route::group(array('domain' => ''), function() {
	Route::get('/', function() {
		return 'API 1';
	Route::get('test', function() {
		return 'API test';
	Route::any('{all}', function($uri) {
	})->where('all', '.*');

This implements a sort of catch-all route and seems to take priority over the accounts route group.

Last updated 2 years ago.

Issue 2 is now also solved using this solution:

//Check for identity segments
if (Request::segment(1) == 'i' and $identity = (int) Request::segment(2)) {
	//Do something with $identity
	$prefix = 'i/'.$identity;
else {
	$prefix = null;

//Wrapper for (optional) identity prefix
Route::group(array('prefix' => $prefix), function() {

	//Other route groups and routes defined here as usual

This way, if there is an identity parameter present, you can filter it out before the routes and set it as a prefix in a wrapper group. If no parameter is given, the prefix is null and is basically ignored.

Last updated 2 years ago.

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.