是否可以将dingo api路由分组到多个域?例如
$api->group(['domain' => ['something.com', 'anotherexample.com]], function ($api) {
// My routes
});
答案 0 :(得分:-2)
您不必重复代码。
$callback = function() {};
Route::group(['domain' => 'foo.bar.dev'], $callback);
Route::group(['domain' => 'foo.bar'], $callback);
但我们还有一个微观解决方案
Route::macro("domain", function(array $domains, \Closure $definition) {
foreach ($domains as $domain) {
Route::group(['domain' => $domain], $definition);
}
});
Route::domain(['foo.bar.dev', 'foo.bar'], function($route) {
// Do stuff
});