Backpack in a subdomain #887
-
I am currently creating a "multi-site", this is the routing I want to achieve :
My route file look like this :
Does Backpack really need the APP_URL ? I tried to set it to "empty" and to "http://admin.mydomain3.com" with no luck. In both case no difference between 1 and 2. Option 1 is my favorite, and CRUDS are OK on it, but why the routes are also available in my other domains ? Why I want to achieve this ?For a website I am building, 1 admin for 2(+) eCommerce, some products are shared between the 2(+) sites, some are not. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hello @cdo9 First, i will suggest that you better separate front-office (for ecommerce customers) from back-office (for admins). As I understand, with your config, you still have /dashboard, /login, etc, accessible from other domains, that is because Backpack automatically creates these routes, you need to disable it from the config, check in our documentation and after this need to create manually these routes. Let me know if you need any other help. Cheers. |
Beta Was this translation helpful? Give feedback.
-
I'm glad you solve the problem. I will close the issue, but please feel free to re-open it or create a new one. Cheers. |
Beta Was this translation helpful? Give feedback.
-
Hello @cdo9 Backpack register some extra routes not exposed in To customize them, you can copy the file from the vendor folder into your Route::group(
[
'namespace' => 'Backpack\CRUD\app\Http\Controllers',
'middleware' => config('backpack.base.web_middleware', 'web'),
'prefix' => config('backpack.base.route_prefix'),
+ 'domain' => 'admin.mydomain3.com
],
function () {
// ... the routes setup
}); That way those routes will only be available under that domain. Hope that helps. Cheers |
Beta Was this translation helpful? Give feedback.
Hello @cdo9
Backpack register some extra routes not exposed in
custom.php
, they are inbase.php
: https://github.com/Laravel-Backpack/CRUD/blob/main/src/routes/backpack/base.phpTo customize them, you can copy the file from the vendor folder into your
routes/backpack/base.php
and do the needed changes there:Route::group( [ 'namespace' => 'Backpack\CRUD\app\Http\Controllers', 'middleware' => config('backpack.base.web_middleware', 'web'), 'prefix' => config('backpack.base.route_prefix'), + 'domain' => 'admin.mydomain3.com ], function () { // ... the routes setup });
That way those routes will only be available under that domain.
Hope that …