searchable()->sortable(), Column::make('Keterangan', 'description')->searchable()->sortable(), Column::make('Icon', 'icon') ->format(function ($value) { $icon = 'flux.icon.'.$value; return view()->exists($icon) ? Blade::render('') : Blade::render(''); }) ->html() ->searchable() ->sortable(), Column::make('Aksi') ->label(function ($row) { $actions = ''; $maxSortOrder = ChooseUs::max('sort_order'); if (auth()->user()->can('update choose us')) { if ($row->sort_order > 1) { $actions .= view('components.actions.table.sort-button', [ 'id' => $row->hash, 'module' => 'chooseUs', 'direction' => 'up', 'tooltip' => 'Naik', 'color' => 'cyan', 'icon' => 'arrow-up', ])->render(); $actions .= view('components.actions.table.sort-button', [ 'id' => $row->hash, 'module' => 'chooseUs', 'direction' => 'first', 'tooltip' => 'Pertama', 'color' => 'emerald', 'icon' => 'bars-arrow-up', ])->render(); } if ($row->sort_order < $maxSortOrder) { $actions .= view('components.actions.table.sort-button', [ 'id' => $row->hash, 'module' => 'chooseUs', 'direction' => 'down', 'tooltip' => 'Turun', 'color' => 'orange', 'icon' => 'arrow-down', ])->render(); $actions .= view('components.actions.table.sort-button', [ 'id' => $row->hash, 'module' => 'chooseUs', 'direction' => 'last', 'tooltip' => 'Terakhir', 'color' => 'rose', 'icon' => 'bars-arrow-down', ])->render(); } } if (auth()->user()->can('update choose us')) { $actions .= view('components.actions.table.edit-modal', [ 'id' => $row->hash, 'method' => 'update', 'modalTitle' => 'Ubah Kategori', ])->render(); } if (auth()->user()->can('delete choose us')) { $actions .= view('components.actions.table.delete', [ 'id' => $row->hash, ])->render(); } return $actions; }) ->html() ->hideIf(auth()->user()->cannot('update choose us') && auth()->user()->cannot('delete choose us')), ]; } public function builder(): Builder { return ChooseUs::select('id', 'name', 'description', 'sort_order')->orderBy('sort_order'); } }