123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <?php
- namespace App\Distributor\Controllers;
- use App\Distributor\Repositories\DistProductParameter;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use Dcat\Admin\Http\Controllers\AdminController;
- use Dcat\Admin\Layout\Content;
- use Dcat\Admin\Admin;
- class DistProductParameterController extends AdminDistController
- {
- /**
- * page index
- */
- public function index(Content $content)
- {
- return $content
- ->view('distributor.layouts.content')
- ->header(admin_trans( 'admin.product_parameter'))
- ->description(admin_trans('admin.all'))
- ->breadcrumb(['text'=>'list','url'=>''])
- ->body($this->grid());
- }
- /**
- * Edit interface.
- *
- * @param mixed $id
- * @param Content $content
- * @return Content
- */
- public function edit($id, Content $content)
- {
- return $content
- ->view('distributor.layouts.content')
- ->translation($this->translation())
- ->title($this->title())
- ->description($this->description()['edit'] ?? trans('admin.edit'))
- ->body($this->form()->edit($id));
- }
- /**
- * Create interface.
- *
- * @param Content $content
- * @return Content
- */
- public function create(Content $content)
- {
- return $content
- ->view('distributor.layouts.content')
- ->translation($this->translation())
- ->title($this->title())
- ->description($this->description()['create'] ?? trans('admin.create'))
- ->body($this->form());
- }
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new DistProductParameter(), function (Grid $grid) {
- $grid->column('id')->sortable();
- $grid->column('name');
- $grid->column('order');
- $grid->column('enabled');
- $grid->column('content');
- $grid->column('created_at');
- $grid->column('updated_at')->sortable();
- $grid->filter(function (Grid\Filter $filter) {
- $filter->equal('id');
- });
- });
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- *
- * @return Show
- */
- protected function detail($id)
- {
- return Show::make($id, new DistProductParameter(), function (Show $show) {
- $show->field('id');
- $show->field('name');
- $show->field('order');
- $show->field('enabled');
- $show->field('content');
- $show->field('created_at');
- $show->field('updated_at');
- });
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- return Form::make(new DistProductParameter(), function (Form $form) {
- $form->display('id');
- $form->text('name');
- $form->text('order');
- $form->text('enabled');
- $form->text('content');
- $form->display('created_at');
- $form->display('updated_at');
- });
- }
- }
|