Laravel-Backpack / theme-tabler

UI for Backpack v6 that uses Tabler and Bootstrap v5.
MIT License
21 stars 12 forks source link

[Bug] With theme-tabler config published get an error in Routing Service provider #57

Closed miquelangeld closed 1 year ago

miquelangeld commented 1 year ago

Bug report

What I did

I published the Theme Tabler configuration.

What happened

I get this error when I execute any artisan command

Illuminate\Routing\UrlGenerator::__construct(): Argument Laravel-Backpack/CRUD#2 ($request) must be of type Illuminate\Http\Request, null given, called in /var/www/html/ve
ndor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 64

What I've already tried to fix it

Commented the line 59 in theme-tabler.php

'urlsUsingOverLapEffect' => [
          //  url(config('backpack.base.route_prefix') . '/dashboard'),
        ],
pxpm commented 1 year ago

Hey @miquelangeld

Nicelly spotted 🙏

We need to re-engineer that solution.

Probably moving to a pattern and/or moving that config to a ServiceProvider.

What I mean is something like, developer give us only the url segments in config:

'urlsUsingOverLapEffect' =>['dashboard', 'my-page/something'],

and we build the full url in the ServiceProvider, something like:

$fullUrls = array_map(fn($item) => url(backpack_url(config('backpack.base.route_prefix') . '/'.$item), config('theme-tabler.urlsUsingOverLapEffect'));
config()->set('theme-tabler.urlsUsingOverLapEffect', $fullUrls);

I will investigate this a little bit more and get back with a solution.

Thanks again for the report @miquelangeld 🙏