@@ -374,6 +374,66 @@ public function it_returns_the_current_url_for_existing_non_localized_routes()
374374 ], $ response ->original );
375375 }
376376
377+ /** @test */
378+ public function it_returns_the_url_for_existing_unnamed_localized_routes_using_domains ()
379+ {
380+ $ this ->withoutExceptionHandling ();
381+ $ this ->setSupportedLocales ([
382+ 'en ' => 'domain.test ' ,
383+ 'nl ' => 'nl.domain.test ' ,
384+ ]);
385+ $ this ->setAppLocale ('en ' );
386+ $ this ->setFallbackLocale ('en ' );
387+
388+ Route::localized (function () {
389+ Route::get ('/ ' , function () {
390+ return [
391+ 'current ' => Route::localizedUrl (),
392+ 'en ' => Route::localizedUrl ('en ' ),
393+ 'nl ' => Route::localizedUrl ('nl ' ),
394+ ];
395+ });
396+ });
397+
398+ $ response = $ this ->call ('GET ' , 'http://domain.test ' );
399+ $ response ->assertOk ();
400+ $ this ->assertEquals ([
401+ 'current ' => 'http://domain.test ' ,
402+ 'en ' => 'http://domain.test ' ,
403+ 'nl ' => 'http://nl.domain.test ' ,
404+ ], $ response ->original );
405+ }
406+
407+ /** @test */
408+ public function it_returns_the_url_for_existing_named_localized_routes_using_domains ()
409+ {
410+ $ this ->withoutExceptionHandling ();
411+ $ this ->setSupportedLocales ([
412+ 'en ' => 'domain.test ' ,
413+ 'nl ' => 'nl.domain.test ' ,
414+ ]);
415+ $ this ->setAppLocale ('en ' );
416+ $ this ->setFallbackLocale ('en ' );
417+
418+ Route::localized (function () {
419+ Route::get ('/ ' , function () {
420+ return [
421+ 'current ' => Route::localizedUrl (),
422+ 'en ' => Route::localizedUrl ('en ' ),
423+ 'nl ' => Route::localizedUrl ('nl ' ),
424+ ];
425+ })->name ('route ' );
426+ });
427+
428+ $ response = $ this ->call ('GET ' , 'http://domain.test ' );
429+ $ response ->assertOk ();
430+ $ this ->assertEquals ([
431+ 'current ' => 'http://domain.test ' ,
432+ 'en ' => 'http://domain.test ' ,
433+ 'nl ' => 'http://nl.domain.test ' ,
434+ ], $ response ->original );
435+ }
436+
377437 /** @test */
378438 public function the_macro_does_not_blow_up_on_a_default_404_error ()
379439 {
0 commit comments