count(); } public static function form(Form $form): Form { return $form ->schema([ // ]); } public static function table(Table $table): Table { return $table ->columns([ BadgeColumn::make('status') ->label(__('Status')) ->enum([ SupportTicket::STATUS_OPEN => __('Open'), SupportTicket::STATUS_CLOSED => __('Closed'), SupportTicket::STATUS_CUSTOMER_REPLY => __('Customer Reply'), SupportTicket::STATUS_SUPPORT_REPLY => __('Support Reply'), ]) ->colors([ 'primary' => [SupportTicket::STATUS_OPEN, SupportTicket::STATUS_SUPPORT_REPLY, SupportTicket::STATUS_CUSTOMER_REPLY], 'danger' => SupportTicket::STATUS_CLOSED, ]) ->wrap(false), TextColumn::make('title') ->searchable() ->sortable(), TextColumn::make('replies_count') ->label(__('Replies')) ->getStateUsing(fn (SupportTicket $record) => $record->replies->count()), TextColumn::make('user.name') ->searchable() ->sortable(), ]) ->filters([ MultiSelectFilter::make('status') ->label(__('Status')) ->options([ SupportTicket::STATUS_OPEN => __('Open'), SupportTicket::STATUS_CLOSED => __('Closed'), SupportTicket::STATUS_CUSTOMER_REPLY => __('Customer Reply'), SupportTicket::STATUS_SUPPORT_REPLY => __('Support Reply'), ]) ->default([ SupportTicket::STATUS_CUSTOMER_REPLY, SupportTicket::STATUS_OPEN, ]), ]); } public static function getEloquentQuery(): Builder { return parent::getEloquentQuery() ->with(['user', 'replies']) ->orderByDesc('updated_at'); } public static function getPages(): array { return [ 'index' => Pages\ListSupportTickets::route('/'), 'view' => Pages\ViewSupportTicket::route('/{record}'), ]; } }