You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\Coupon;use Dcat\Admin\Form;use Dcat\Admin\Grid;use Dcat\Admin\Show;use Dcat\Admin\Controllers\AdminController;use App\Models\Coupon as couponModel;
class CouponController extends AdminController{ /** * Make a grid builder. * * @return Grid */ protected function grid() { return Grid::make($c = new Coupon(), function (Grid $grid) { $grid->id->sortable(); $grid->title; $grid->start_time->display(function($time){ return date('Y-m-d H:i:s',$time); }); $grid->end_time->display(function($time){ return date('Y-m-d H:i:s',$time); });
$grid->full_amount; $grid->discounts; $grid->discount_type;
$grid->inventory; $grid->inventory_use; $grid->type; $grid->active_type;
$grid->status ->using( config('coupon.status') ) ->label( config('coupon.status_label') );
// $grid->usable_start_time->display(function($time){
// return date('Y-m-d H:i:s',$time);
// });
// $grid->usable_end_time->display(function($time){
// return date('Y-m-d H:i:s',$time);
// });
$grid->filter(function (Grid\Filter $filter) { $filter->like('name'); }); }); }
/** * Make a show builder. * * @param mixed $id * * @return Show */ protected function detail($id) { return Show::make($id, new Coupon(), function (Show $show) { $show->id; $show->title; $show->introduce; $show->start_time; $show->end_time; $show->full_amount; $show->discounts; $show->is_new_user; $show->inventory; $show->inventory_use; $show->type; $show->market_id; $show->storetype_id; $show->category; $show->active_type; $show->status; $show->remark; $show->weigh; $show->usable_number; $show->usable_start_time; $show->usable_end_time; $show->discount_type; $show->created_at; $show->updated_at; }); }
/** * Make a form builder. * * @return Form */ protected function form() { return Form::make(new Coupon(), function (Form $form) { $form->display('id'); $form->text('title'); $form->text('introduce'); $form->text('start_time'); $form->text('end_time'); $form->text('full_amount'); $form->text('discounts'); $form->text('is_new_user'); $form->text('inventory'); $form->text('inventory_use'); $form->text('type'); $form->text('market_id'); $form->text('storetype_id'); $form->text('category'); $form->text('active_type'); $form->text('status'); $form->text('remark'); $form->text('weigh'); $form->text('usable_number'); $form->text('usable_start_time'); $form->text('usable_end_time'); $form->text('discount_type'); $form->display('created_at'); $form->display('updated_at'); }); }}
|