kdion4891 / laravel-livewire-tables

A dynamic, responsive Laravel Livewire table component with searching, sorting, checkboxes, and pagination.
302 stars 41 forks source link

How can I use search on secondary table in joining statement? #33

Open codepoetryindia opened 4 years ago

codepoetryindia commented 4 years ago

public function query() { $response = Transaction::latest()->select('transactions.*', 'users.name', 'users.mobile') ->join('users', 'transactions.user_id', 'users.id'); return $response; }

public function columns() { return [ // Column::make('ID')->searchable()->sortable(),
Column::make("Date", 'created_at')->view('livewire.admin.partial.common.date-format')->sortable(), Column::make('Order No', 'order_id')->searchable()->sortable(), Column::make('Name', 'name')->searchable('users.name')->sortable(),
Column::make('Amount')->sortable(),
Column::make("Payment", 'payment_status')->view('livewire.admin.partial.common.payment-status'), Column::make("Service", 'order_status')->view('livewire.admin.partial.common.service-status'),
Column::make()->view('livewire.admin.partial.common.common-action'), ]; }