<?php

namespace App\Admin\Controllers;

use App\Models\MedicationEntrustment;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;

class MedicationEntrustmentController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new MedicationEntrustment(), function (Grid $grid) {
           
            $grid->column('student_id');
            $grid->column('reason');
            $grid->column('use_time');
            $grid->column('detail');
            $grid->column('desc');
            $grid->column('photos')->image('',80);
            $grid->column('sign');

            $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 MedicationEntrustment(), function (Show $show) {
            $show->field('id');
            $show->field('student_id');
            $show->field('reason');
            $show->field('use_time');
            $show->field('detail');
            $show->field('desc');
            $show->field('photos');
            $show->field('sign');
            $show->field('created_at');
            $show->field('updated_at');
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new MedicationEntrustment(), function (Form $form) {
           
            $form->text('student_id');
            $form->text('reason');
            $form->text('use_time');
            $form->text('detail');
            $form->text('desc');
            $form->text('photos');
            $form->text('sign');

        });
    }
}
