Change the route to the Aimeos admin panel

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
iwpress
Posts: 16
Joined: 04 Feb 2024, 17:22

Change the route to the Aimeos admin panel

Post by iwpress » 04 Feb 2024, 23:01

Hello,
[*]aimeos/ai-laravel v.2023.10.4, Laravel v.10.43.0, PHP v.8.1.27, MacOS 14.2

I want to add aimeos-laravel to an existing project. I already have my own admin panel in the project. Can I change the route to the Aimeos admin panel from /admin to another one, like /wm-shop, in the Aimeos settings?
Best regards.

Gagik
Posts: 38
Joined: 05 Dec 2023, 06:58

Re: Change the route to the Aimeos admin panel

Post by Gagik » 05 Feb 2024, 11:22

Hi

You have to overwrite this line to your configuration file.
https://github.com/aimeos/aimeos-larave ... op.php#L16

iwpress
Posts: 16
Joined: 04 Feb 2024, 17:22

Re: Change the route to the Aimeos admin panel

Post by iwpress » 05 Feb 2024, 14:18

Thanks Gagik!
Uncommented and vaporized:

Code: Select all

 'admin' => ['prefix' => 'wm-shop', 'middleware' => ['web']],
Now I have the correct route:

Code: Select all

GET|HEAD wm-shop ...aimeos_shop_admin › Aimeos\Shop › AdminController@indexAction
But I still get to the route: /wm-admin (this is my dashboard), by the way, this is my HOME in my RouteServiceProvider:

Code: Select all

class RouteServiceProvider extends ServiceProvider
{
      public const HOME = '/wm-admin';
Best Regards

User avatar
aimeos
Administrator
Posts: 7894
Joined: 01 Jan 1970, 00:00

Re: Change the route to the Aimeos admin panel

Post by aimeos » 05 Feb 2024, 14:39

There may be another one here you have to change:
https://github.com/aimeos/aimeos/blob/2 ... er.php#L32

Also make sure your change the prefix for these routes too to avoid interfering with your other /admin routes:
https://github.com/aimeos/aimeos/blob/2 ... php#L9-L11
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

iwpress
Posts: 16
Joined: 04 Feb 2024, 17:22

Re: Change the route to the Aimeos admin panel

Post by iwpress » 05 Feb 2024, 21:41

Thanks for the help,
Performed by:
https://github.com/aimeos/aimeos-larave ... op.php#L16
https://github.com/aimeos/aimeos/blob/6 ... php#L9-L11
Now I have the following routes:

Code: Select all

GET|HEAD        wm-shop..................................... aimeos_shop_admin › Aimeos\Shop › AdminController@indexAction
POST            wm-shop/{site}/graphql...................... aimeos_shop_graphql_post › Aimeos\Shop › GraphqlController@indexAction
POST            wm-shop/{site}/jqadm/batch/{resource}....... aimeos_shop_jqadm_batch › Aimeos\Shop › JqadmController@batchAction
GET|POST|HEAD   wm-shop/{site}/jqadm/copy/{resource}/{id}... aimeos_shop_jqadm_copy › Aimeos\Shop › JqadmController@copyAction
GET|POST|HEAD   wm-shop/{site}/jqadm/create/{resource}...... aimeos_shop_jqadm_create › Aimeos\Shop › JqadmController@createAction
POST            wm-shop/{site}/jqadm/delete/{resource}/{id?}.... aimeos_shop_jqadm_delete › Aimeos\Shop › JqadmController@deleteAction
GET|POST|HEAD   wm-shop/{site}/jqadm/export/{resource}...... aimeos_shop_jqadm_export › Aimeos\Shop › JqadmController@exportAction
GET|HEAD        wm-shop/{site}/jqadm/file/{type}............ aimeos_shop_jqadm_file › Aimeos\Shop › JqadmController@fileAction
GET|HEAD        wm-shop/{site}/jqadm/get/{resource}/{id}.... aimeos_shop_jqadm_get › Aimeos\Shop › JqadmController@getAction
POST            wm-shop/{site}/jqadm/save/{resource}........ aimeos_shop_jqadm_save › Aimeos\Shop › JqadmController@saveAction
GET|POST|HEAD   wm-shop/{site}/jqadm/search/{resource}...... aimeos_shop_jqadm_search › Aimeos\Shop › JqadmController@searchAction
OPTIONS         wm-shop/{site}/jsonadm/{resource?}.......... aimeos_shop_jsonadm_options › Aimeos\Shop › JsonadmController@optionsAction
DELETE          wm-shop/{site}/jsonadm/{resource}/{id?}..... aimeos_shop_jsonadm_delete › Aimeos\Shop › JsonadmController@deleteAction
GET|HEAD        wm-shop/{site}/jsonadm/{resource}/{id?}..... aimeos_shop_jsonadm_get › Aimeos\Shop › JsonadmController@getAction
PATCH           wm-shop/{site}/jsonadm/{resource}/{id?}..... aimeos_shop_jsonadm_patch › Aimeos\Shop › JsonadmController@patchAction
POST            wm-shop/{site}/jsonadm/{resource}/{id?}..... aimeos_shop_jsonadm_post › Aimeos\Shop › JsonadmController@postAction
PUT             wm-shop/{site}/jsonadm/{resource}/{id?}..... aimeos_shop_jsonadm_put › Aimeos\Shop › JsonadmController@putAction
Didn't understand what to change here: <<<<
https://github.com/aimeos/aimeos/blob/6 ... er.php#L32

Code: Select all

  public static function home()
    {
        if( config( 'app.shop_registration' ) ) {
            return route('aimeos_shop_admin');
        }
        return airoute( 'aimeos_shop_account' );
    }
But I couldn't find where the redirect from /wm-shop (Aimeos admin) to /wm-admin (site admin) comes from.
Best Regards

User avatar
aimeos
Administrator
Posts: 7894
Joined: 01 Jan 1970, 00:00

Re: Change the route to the Aimeos admin panel

Post by aimeos » 07 Feb 2024, 09:04

iwpress wrote: 05 Feb 2024, 21:41 https://github.com/aimeos/aimeos/blob/6 ... er.php#L32

Code: Select all

  public static function home()
    {
        if( config( 'app.shop_registration' ) ) {
            return route('aimeos_shop_admin');
        }
        return airoute( 'aimeos_shop_account' );
    }
This was recently changed from "/admin" to return "route('aimeos_shop_admin')" so it's not a fixed string.
iwpress wrote: 05 Feb 2024, 21:41 But I couldn't find where the redirect from /wm-shop (Aimeos admin) to /wm-admin (site admin) comes from.
The redirect after the login check is done here:
https://github.com/aimeos/aimeos-larave ... roller.php
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

iwpress
Posts: 16
Joined: 04 Feb 2024, 17:22

Re: Change the route to the Aimeos admin panel

Post by iwpress » 07 Feb 2024, 13:15

Thank you very much for your detailed response.
I'll be looking into it.
Regards

iwpress
Posts: 16
Joined: 04 Feb 2024, 17:22

Re: Change the route to the Aimeos admin panel

Post by iwpress » 07 Feb 2024, 23:38

Hi,
This was recently changed from "/admin" to return "route('aimeos_shop_admin')" so it's not a fixed string.
I installed aimeos-laravel on an existing project and didn't find this RouteServiceProvider here. It is in the aimeos package.
The redirect after the login check is done here:
https://github.com/aimeos/aimeos-larave ... roller.php
I looked through the AdminController and found here:

Code: Select all

$param = array(
	'resource' => config( 'shop.panel', 'dashboard' ),
I edited the line in config/shop.php:

Code: Select all

'panel'  => 'wm-shop', // panel shown in admin backend after login
So far, I can't find a way to call the Aimeos admin panel if a project has its own admin panel, no matter what its route is.

Best Regards

Post Reply