/home/techb158/immovalet.com/platform/plugins/ecommerce/src/Tables
NameSizeModeActions
Reports/-0755rm
BrandTable.php53540644editdlrm
CustomerTable.php46940644editdlrm
DiscountTable.php42770644editdlrm
FlashSaleTable.php43380644editdlrm
OrderIncompleteTable.php32180644editdlrm
OrderTable.php66480644editdlrm
ProductAttributeSetsTable.php53410644editdlrm
ProductCategoryTable.php56840644editdlrm
ProductCollectionTable.php56820644editdlrm
ProductLabelTable.php44180644editdlrm
ProductTable.php82690644editdlrm
ProductTagTable.php43360644editdlrm
ReviewTable.php53900644editdlrm
TaxTable.php46640644editdlrm
Edit: /home/techb158/immovalet.com/platform/plugins/ecommerce/src/Tables/DiscountTable.php (4277B)
repository = $discountRepository; if (!Auth::user()->hasPermission('discounts.destroy')) { $this->hasOperations = false; $this->hasActions = false; } } /** * {@inheritDoc} */ public function ajax() { $data = $this->table ->eloquent($this->query()) ->editColumn('detail', function ($item) { return view('plugins/ecommerce::discounts.detail', compact('item'))->render(); }) ->editColumn('checkbox', function ($item) { return $this->getCheckbox($item->id); }) ->editColumn('total_used', function ($item) { if ($item->type === 'promotion') { return '-'; } if ($item->quantity === null) { return $item->total_used; } return $item->total_used . '/' . $item->quantity; }) ->editColumn('start_date', function ($item) { return BaseHelper::formatDate($item->start_date); }) ->editColumn('end_date', function ($item) { if (!$item->end_date) { return '-'; } return $item->end_date; }) ->addColumn('operations', function ($item) { return $this->getOperations(null, 'discounts.destroy', $item); }); return $this->toJson($data); } /** * {@inheritDoc} */ public function query() { $query = $this->repository->getModel()->select(['*']); return $this->applyScopes($query); } /** * {@inheritDoc} */ public function columns() { return [ 'id' => [ 'title' => trans('core/base::tables.id'), 'width' => '20px', 'class' => 'text-left', ], 'detail' => [ 'name' => 'code', 'title' => trans('plugins/ecommerce::discount.detail'), 'class' => 'text-left', ], 'total_used' => [ 'title' => trans('plugins/ecommerce::discount.used'), 'width' => '100px', ], 'start_date' => [ 'title' => trans('plugins/ecommerce::discount.start_date'), 'class' => 'text-center', ], 'end_date' => [ 'title' => trans('plugins/ecommerce::discount.end_date'), 'class' => 'text-center', ], ]; } /** * {@inheritDoc} */ public function buttons() { return $this->addCreateButton(route('discounts.create'), 'discounts.create'); } /** * {@inheritDoc} */ public function bulkActions(): array { return $this->addDeleteAction(route('discounts.deletes'), 'discounts.destroy', parent::bulkActions()); } /** * {@inheritDoc} */ public function renderTable($data = [], $mergeData = []) { if ($this->query()->count() === 0 && !$this->request()->wantsJson() && $this->request()->input('filter_table_id') !== $this->getOption('id') ) { return view('plugins/ecommerce::discounts.intro'); } return parent::renderTable($data, $mergeData); } }