user()->current_project_id); } protected function getTableColumns(): array { return [ IconColumn::make('provider') ->icon(fn (NotificationChannel $record) => 'icon-'.$record->provider) ->width(24), TextColumn::make('label') ->default(fn (NotificationChannel $record) => $record->label) ->searchable() ->sortable(), TextColumn::make('id') ->label('Global') ->badge() ->color(fn (NotificationChannel $record) => $record->project_id ? 'gray' : 'success') ->formatStateUsing(function (NotificationChannel $record) { return $record->project_id ? 'No' : 'Yes'; }), TextColumn::make('created_at') ->label('Created At') ->formatStateUsing(fn (NotificationChannel $record) => $record->created_at_by_timezone) ->searchable() ->sortable(), ]; } public function table(Table $table): Table { return $table ->heading(null) ->query($this->getTableQuery()) ->columns($this->getTableColumns()) ->actions([ EditAction::make('edit') ->modalHeading('Edit Notification Channel') ->mutateRecordDataUsing(function (array $data, NotificationChannel $record) { return [ 'label' => $record->label, 'global' => ! $record->project_id, ]; }) ->form(Edit::form()) ->authorize(fn (NotificationChannel $record) => auth()->user()->can('update', $record)) ->using(fn (array $data, NotificationChannel $record) => Edit::action($record, $data)) ->modalWidth(MaxWidth::Medium), DeleteAction::make('delete') ->modalHeading('Delete Notification Channel') ->authorize(fn (NotificationChannel $record) => auth()->user()->can('delete', $record)) ->using(function (array $data, NotificationChannel $record) { $record->delete(); }), ]); } }