I am trying to include widgets in the resource view that are connected with multiple Relation Managers and getting this error while changing between Relation Managers.
in my widget:
class SpecificMemberStat extends BaseWidget
{
use InteractsWithPageTable;
public static string $resource = MemberResource::class;
protected static ?string $pollingInterval = null;
public ?Model $record = null;
protected function getStats(): array
{
return [
Stat::make('Time Since Joining', Carbon::now()->diff($this->record->joining_date)->format('%y years %m months'))->color('success'),
Stat::make('Total Salary Received','৳ ' .$this->record->salaryPayments->sum('payment_amount'))->color('success'),
Stat::make('Current Salary', '৳ ' . $this->record->current_salary)->description('Last Promoted ' .Carbon::parse($this->record->promotions->sortByDesc('promotion_date')->first()->promotion_date)->diffForHumans())->color('success'),
Stat::make('Week Win', $this->record->weeklyWinners->count())->color('success'),
];
}
}
in my resource view page:
protected function getHeaderWidgets(): array
{
return [
SpecificMemberStat::class,
];
}
In my MemberResouce I have this relation manager:
public static function getRelations(): array
{
return [
RelationManagers\LeavesRelationManager::class,
RelationManagers\WeeklyWinnersRelationManager::class,
RelationManagers\PromotionRelationManager::class,
RelationManagers\SalaryIncrementsRelationManager::class,
RelationManagers\SalaryPaymentsRelationManager::class,
];
}
expecting to show the widgets in the Relation Managers.
Just added in widgets
public array $tableColumnSearches = [];