dembilesmana
2 months ago
255
0
Laravel

direct each route('register') to the domain that is currently being accessed

Posted 2 months ago by dembilesmana

I made a multi-app with a codebase style,

I have a problem if I open the login page at admin.app.dev/login the link to register leads to client.app.dev/register that should lead to admin.app.dev/register.

public function map()
{
	$this->mapAdminRoutes();
	$this->mapClientRoutes();
}

protected function mapAdminRoutes()
{
	Route::domain('admin.app.dev')
		->middleware('web')
		->namespace($this->namespace)
		->group(base_path('routes/admin.php'));
}

protected function mapClientRoutes()
{
	Route::domain('client.app.dev')
		->middleware('web')
		->namespace($this->namespace)
		->group(base_path('routes/client.php'));
}

routes/admin.php

Auth::routes();

routes/client.php

Auth::routes();

views/auth/login.blade.php

<a href="{{ route('register') }}">Register</a>

// the link only refers to the route that was last called.
// client.app.dev/register

I want to direct each route('register') to the domain that is currently being accessed

Please help.

Please sign in or create an account to participate in this conversation.