FleetCart/Modules/Coupon/Admin/CouponTable.php

27 lines
617 B
PHP
Raw Normal View History

2023-06-11 12:14:03 +00:00
<?php
namespace Modules\Coupon\Admin;
use Modules\Admin\Ui\AdminTable;
2023-12-03 14:07:47 +00:00
use Illuminate\Http\JsonResponse;
use Yajra\DataTables\Exceptions\Exception;
2023-06-11 12:14:03 +00:00
class CouponTable extends AdminTable
{
/**
* Make table response for the resource.
*
2023-12-03 14:07:47 +00:00
* @return JsonResponse
* @throws Exception
2023-06-11 12:14:03 +00:00
*/
public function make()
{
return $this->newTable()
->addColumn('discount', function ($coupon) {
return $coupon->is_percent
? "{$coupon->value}%"
: $coupon->value->format();
});
}
}