I have created a custom dashboard page and replaced it with main dashboard page. It loads perfectly. And the stats widget is also shown. But the problem is I can't pass props to the blade view. The static function view that I wrote doesn't actually exist in Page class. So it's not automatically executed. But protected static string $view = 'filament.pages.dashboard';
is executed and the view page is displayed. But I want to pass user information and other datas to the blade page. I am using filament 3. And this is my dashboard Page snippet
<?php
namespace App\Filament\Pages;
use App\Filament\Widgets\OverviewWidget;
use App\Filament\Widgets\StatsOverview;
use Filament\Pages\Page;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
class Dashboard extends Page
{
protected static ?string $navigationIcon = 'heroicon-o-home';
protected static string $view = 'filament.pages.dashboard';
protected function getHeaderWidgets(): array
{
return [
StatsOverview::class,
];
}
// create a view
public static function view(): View
{
$user = auth()->user(); // get the authenticated user
Log::inf("Hello Earth");
return view('filament.pages.dashboard', compact('user'));
}
}
And this is my view blade page
<x-filament-panels::page>
Hello {{ $user->name }}
</x-filament-panels::page>
It says the $user is undefined