applications()->pending()->count(); return $pending > 0 ? (string) $pending : null; } public static function canViewForRecord(Model $ownerRecord, string $pageClass): bool { // The inbox holds personal data, so it stays behind its own permission // even for someone already allowed to edit the call. return (bool) Auth::user()?->can('applications.view_any'); } public function table(Table $table): Table { return $table ->defaultSort('created_at', 'desc') ->columns([ TextColumn::make('name') ->label(__('panel.applications.fields.name')) ->weight('medium') ->description(fn (Application $record) => $record->email), TextColumn::make('hours_per_week') ->label(__('panel.applications.fields.hours_per_week')) ->badge() ->color('info') ->formatStateUsing(fn (?int $state) => $state ? "{$state} h" : '—'), TextColumn::make('status') ->label(__('panel.applications.fields.status')) ->badge(), TextColumn::make('created_at') ->label(__('panel.applications.fields.received_at')) ->since() ->dateTimeTooltip(), ]) ->recordActions([ Action::make('open') ->label(__('panel.applications.actions.open')) ->icon('heroicon-o-arrow-top-right-on-square') ->url(fn (Application $record) => ApplicationResource::getUrl('view', ['record' => $record])), Action::make('mark_contacted') ->label(__('panel.applications.actions.contacted')) ->icon('heroicon-o-chat-bubble-left-right') ->color('info') ->authorize('update') ->visible(fn (Application $record) => $record->status === ApplicationStatus::New) ->action(fn (Application $record) => $record->markAs( ApplicationStatus::Contacted, Auth::user(), )), ]) ->emptyStateHeading(__('panel.applications.empty.call_heading')) ->emptyStateIcon('heroicon-o-inbox'); } }