FilamentF
Filamentβ€’3y ago
Gunnolfson

Unable to detect application namespace.

Hi
I'm working on a new project. We set up an architecture based on the Laravel Beyond Crud ebook written by Spatie. We then splitted our code into Application and Domain folders. To do this, we edited the autoload section and the bootstrap.php file:
"autoload": {
    "psr-4": {
        "App\\": "src/Application/",
        "Domain\\": "src/Domain/",
        "Database\\Factories\\": "database/factories/",
        "Database\\Seeders\\": "database/seeders/"
    }
},
"autoload-dev": {
    "psr-4": {
        "Tests\\": "tests/"
    }
},

$app = new Application(
    $_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
$app->useAppPath('src/Application');

I also changed some configuration inside
filament.php
to point out the new folders:
return [
    'pages' => [
        'namespace' => 'Domain\\Admin\\Pages',
        'path' => app_path('../Domain/Admin/Pages'),
        'register' => [
            Pages\Dashboard::class,
        ],
    ],
    'resources' => [
        'namespace' => 'Domain\\Admin\\Resources',
        'path' => app_path('../Domain/Admin/Resources'),
        'register' => [],
    ],
    'widgets' => [
        'namespace' => 'Domain\\Admin\\Widgets',
        'path' => app_path('../Domain/Admin/Widgets'),
        'register' => [
            Widgets\AccountWidget::class,
            Widgets\FilamentInfoWidget::class,
        ],
    ],
    'livewire' => [
        'namespace' => 'Domain\\Admin',
        'path' => app_path('../Domain/Admin'),
    ],
];

The test suite works well and the other pages are also working. Seems only Filament got the issue πŸ€”
Any idea how to debug this?
Was this page helpful?