F
Filament3mo ago
nowak

I get Class "App\Filament\Pages\Dashboard" not found after removing Dashboard on Production

I wanted to create a custom dashboard instead of the default panel dashboard. I named my custom dashboard class something other than Dashboard, which I had no issues with when developing locally. Then when pushing my changes to Production (Staging environment), I get the Class "App\Filament\Pages\Dashboard" not found error. Has anyone else experienced something similar? It is very strange that I get the error on production but not locally.
18 Replies
Lara Zeus
Lara Zeus3mo ago
did you set it on the panel provider ->pages() also looks like file came case sensitive between linux and windows or mac!
nowak
nowakOP3mo ago
No I removed everything from ->pages([]) on the panel provider.
Lara Zeus
Lara Zeus3mo ago
I think filament need a default page to land on it 🙂 try add the new dashboard you made in ->pages()
nowak
nowakOP3mo ago
Thanks! I will try that next time I push to production. But strange that filament doesn't need this on my local environment.
Lara Zeus
Lara Zeus3mo ago
it could be cached on local?
nowak
nowakOP2mo ago
I just tried to add to add my new dashboard to ->pages() like this:
->pages([
KitchenDashboard::class,
])
->pages([
KitchenDashboard::class,
])
And I still get the error: Class "App\Filament\Pages\Dashboard" not found But I just don't understand where filament gets App\Filament\Pages\Dashboard from, as I don't have that in my code anywhere 🤔 Here is a shared flare of my error, it seems to have something to do with routes: https://flareapp.io/share/LPd0G9dP
Flare
Class "App\Filament\Pages\Dashboard" not found - The error occurred at https://appstaging.meinrad.ch/admin/kitchen
nowak
nowakOP2mo ago
I do have this route in my routes/web.php file:
Route::get('/dashboard', function () {
return redirect()->route('home');
})->name('dashboard');
Route::get('/dashboard', function () {
return redirect()->route('home');
})->name('dashboard');
Which I use for my inertia frontend. Maybe this has something to do with it?
awcodes
awcodes2mo ago
Did you extend filaments dashboard class in KitchenDashboard? Sounds like a missing use statement.
nowak
nowakOP2mo ago
I did this:
<?php

namespace App\Filament\Pages;

use App\Models\MealType;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Form;
use Filament\Pages\Dashboard as BaseDashboard;
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
use App\Filament\Widgets;

class KitchenDashboard extends BaseDashboard
{

use BaseDashboard\Concerns\HasFiltersForm;

protected static ?string $title = 'Kitchen Dashboard';
protected static ?string $navigationIcon = 'icon-chef-hat';
protected static string $routePath = 'kitchen';
.......
<?php

namespace App\Filament\Pages;

use App\Models\MealType;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Form;
use Filament\Pages\Dashboard as BaseDashboard;
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
use App\Filament\Widgets;

class KitchenDashboard extends BaseDashboard
{

use BaseDashboard\Concerns\HasFiltersForm;

protected static ?string $title = 'Kitchen Dashboard';
protected static ?string $navigationIcon = 'icon-chef-hat';
protected static string $routePath = 'kitchen';
.......
awcodes
awcodes2mo ago
this should probably just be HasFiltersForm
use BaseDashboard\Concerns\HasFiltersForm;

use HasFiltersForm;
use BaseDashboard\Concerns\HasFiltersForm;

use HasFiltersForm;
nowak
nowakOP2mo ago
I removed KitchenDashboard from my admin panel provider pages as this wasn't necessary on a fresh filament installation, and changed to:
use HasFiltersForm;
use HasFiltersForm;
I get the same ish error still:
include(/home/www/appstaging.meinrad.ch/app/Filament/Pages/Dashboard.php): Failed to open stream: No such file or directory
include(/home/www/appstaging.meinrad.ch/app/Filament/Pages/Dashboard.php): Failed to open stream: No such file or directory
Here is my flare error: https://flareapp.io/share/bP9oYg85
Flare
include(/home/www/appstaging.meinrad.ch/app/Filament/Pages/Dashboard.php): Failed to open stream: No such file or directory - The error occurred at https://appstaging.meinrad.ch/admin
nowak
nowakOP2mo ago
Still weird that I have no issues on my local environment, only on my remote server do I get this error.
awcodes
awcodes2mo ago
Maybe a permissions issue on the server. Definitely something odd going on with the namespaces. One thing to try would be to delete vendor and composer install.
igorclauss
igorclauss2mo ago
Could it be a cached binding in the bootstrap/cache directory?
nowak
nowakOP2mo ago
Yes! I found this:
'app.filament.pages.dashboard' => 'App\\Filament\\Pages\\Dashboard',
'app.filament.pages.dashboard' => 'App\\Filament\\Pages\\Dashboard',
in /bootstrap/cache/filament/panels/admin.php What is the recommended way of clearing this cache?
Lara Zeus
Lara Zeus2mo ago
artisan optimize:clear
artisan config:cache
artisan route:cache
artisan icons:cache
artisan view:cache
artisan optimize:clear
artisan config:cache
artisan route:cache
artisan icons:cache
artisan view:cache
nowak
nowakOP2mo ago
Should this be ran on every deploy? I had to use this as well I think:
php artisan filament:optimize-clear
php artisan filament:optimize-clear
Are you saying this wasn't necessary?
Lara Zeus
Lara Zeus2mo ago
i didn't say its necessary or not everyone has different use case use what you need and what works for you yes i recommend you read more about these commands and what they do
Want results from more Discord servers?
Add your server