Target class [translator] does not exist.

This error appeared when I upgraded v3.0.12 => v3.0.14. Does anybody have any idea what is broken is 3.0.13 or 3.0.14? Maybe translation engine is no longer available for AppPanelProvider?
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

Illuminate\Contracts\Container\BindingResolutionException

Target class [translator] does not exist.

at vendor/laravel/framework/src/Illuminate/Container/Container.php:914
910▕
911▕ try {
912▕ $reflector = new ReflectionClass($concrete);
913▕ } catch (ReflectionException $e) {
➜ 914▕ throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e);
915▕ }
916▕
917▕ // If the type is not instantiable, the developer is attempting to resolve
918▕ // an abstract type such as an Interface or Abstract Class and there is

+9 vendor frames
10 app/Providers/Filament/AppPanelProvider.php:229

11 app/Providers/Filament/AppPanelProvider.php:84
App\Providers\Filament\AppPanelProvider::getUserMenuItems()

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

Illuminate\Contracts\Container\BindingResolutionException

Target class [translator] does not exist.

at vendor/laravel/framework/src/Illuminate/Container/Container.php:914
910▕
911▕ try {
912▕ $reflector = new ReflectionClass($concrete);
913▕ } catch (ReflectionException $e) {
➜ 914▕ throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e);
915▕ }
916▕
917▕ // If the type is not instantiable, the developer is attempting to resolve
918▕ // an abstract type such as an Interface or Abstract Class and there is

+9 vendor frames
10 app/Providers/Filament/AppPanelProvider.php:229

11 app/Providers/Filament/AppPanelProvider.php:84
App\Providers\Filament\AppPanelProvider::getUserMenuItems()

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
6 Replies
Patrick Boivin
Patrick Boivin16mo ago
Can you share your AppPanelProvider code?
StanProg
StanProgOP16mo ago
<?php

declare(strict_types=1);

namespace App\Providers\Filament;

use App\Filament\Pages\Account;
use Filament\Navigation\MenuItem;
use Filament\Panel;
use Filament\PanelProvider;


class AppPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->userMenuItems($this->getUserMenuItems());
}

/**
* @return array
*/
private function getUserMenuItems(): array
{
$userMenuItems = [];

$userMenuItems[] = MenuItem::make()
->label(__('pages/account.title'))
->url(function() {
return Account::getUrl();
})
->icon('heroicon-s-user');

return $userMenuItems;
}
}
<?php

declare(strict_types=1);

namespace App\Providers\Filament;

use App\Filament\Pages\Account;
use Filament\Navigation\MenuItem;
use Filament\Panel;
use Filament\PanelProvider;


class AppPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->userMenuItems($this->getUserMenuItems());
}

/**
* @return array
*/
private function getUserMenuItems(): array
{
$userMenuItems = [];

$userMenuItems[] = MenuItem::make()
->label(__('pages/account.title'))
->url(function() {
return Account::getUrl();
})
->icon('heroicon-s-user');

return $userMenuItems;
}
}
The problem was introduced in 3.0.14. I've checked version by version. @Dan Harrin Any ideas?
krekas
krekas16mo ago
#✅┊rules no1
Dennis Koch
Dennis Koch16mo ago
This was already fixed. But if you register translations in a Service Provider they won't work anyway, since the locale is only set inside a Middleware.
StanProg
StanProgOP16mo ago
Translations in Service Provider worked until 3.0.14. I refactored the code to work on 3.0.14+ like that:
->label(function() {
return __('pages/invoices.title');
})
->label(function() {
return __('pages/invoices.title');
})
Dan Harrin
Dan Harrin16mo ago
yup but we also fixed it in core on .17
Want results from more Discord servers?
Add your server