![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/ledger.corals.io/Corals/modules/Ledger/DataTables/ |
<?php namespace Corals\Modules\Ledger\DataTables; use Corals\Foundation\DataTables\BaseDataTable; use Corals\Modules\Ledger\Facades\Ledger; use Corals\Modules\Ledger\Models\Record; use Corals\Modules\Ledger\Transformers\RecordTransformer; use Yajra\DataTables\EloquentDataTable; class RecordsDataTable extends BaseDataTable { /** * Build DataTable class. * * @param mixed $query Results from query() method. * @return \Yajra\DataTables\DataTableAbstract */ public function dataTable($query) { $this->setResourceUrl(config('ledger.models.record.resource_url')); $dataTable = new EloquentDataTable($query); return $dataTable->setTransformer(new RecordTransformer()); } /** * Get query source of dataTable. * @param Record $model * @return \Illuminate\Database\Eloquent\Builder|static */ public function query(Record $model) { return $model->newQuery(); } /** * Get columns. * * @return array */ protected function getColumns() { return [ 'id' => ['visible' => false], 'code' => ['title' => trans('Ledger::attributes.record.code')], 'account' => [ 'title' => trans('Ledger::attributes.record.account_id'), 'orderable' => false, 'searchable' => false, ], 'record_date' => ['title' => trans('Ledger::attributes.record.record_date')], 'type' => ['title' => trans('Ledger::attributes.record.type')], 'amount' => ['title' => trans('Ledger::attributes.record.amount')], 'payment_method' => ['title' => trans('Ledger::attributes.record.payment_method')], 'status' => ['title' => trans('Corals::attributes.status')], 'notes' => ['title' => trans('Ledger::attributes.record.notes')], 'updated_at' => ['title' => trans('Corals::attributes.updated_at')], ]; } public function getFilters() { return [ 'account_id' => [ 'title' => trans('Ledger::attributes.record.account_id'), 'class' => 'col-md-2', 'type' => 'select2', 'options' => Ledger::getAccounts(), 'active' => true ], 'status' => [ 'title' => trans('Corals::attributes.status'), 'class' => 'col-md-2', 'type' => 'select2', 'options' => trans('Ledger::attributes.status_options'), 'active' => true ], 'currency' => [ 'title' => trans('Ledger::attributes.record.currency'), 'class' => 'col-md-2', 'type' => 'select2', 'options' => config('ledger.supported_currencies'), 'active' => true ], 'type' => [ 'title' => trans('Ledger::attributes.record.type'), 'class' => 'col-md-2', 'type' => 'select', 'options' => trans('Ledger::attributes.record.record_type_options'), 'active' => true ], 'payment_method' => [ 'title' => trans('Ledger::attributes.record.payment_method'), 'class' => 'col-md-2', 'type' => 'select', 'options' => trans('Ledger::attributes.record.payment_method_options'), 'active' => true ], 'record_date' => [ 'title' => trans('Ledger::attributes.record.record_date'), 'class' => 'col-md-4', 'type' => 'date_range', 'active' => true ], 'properties' => [ 'title' => trans('Properties'), 'class' => 'col-md-3', 'type' => 'text', 'condition' => 'like', 'active' => true ], ]; } protected function getBulkActions() { return [ 'confirm' => [ 'title' => trans('Ledger::labels.record.confirm'), 'permission' => 'Ledger::record.update', 'confirmation' => '' ], 'reopen' => [ 'title' => trans('Ledger::labels.record.reopen'), 'permission' => 'Ledger::record.update', 'confirmation' => '' ] ]; } protected function getOptions() { return ['resource_url' => url(config('ledger.models.record.resource_url'))]; } }