<?php

namespace App\Admin\Controllers;

use App\Admin\Repositories\MemberUser;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;

class MemberUserController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new MemberUser(), function (Grid $grid) {
            $grid->column('id')->sortable();
            $grid->column('mobile');
            $grid->column('password');
            $grid->column('status');
            $grid->column('register_ip');
            $grid->column('register_terminal');
            $grid->column('login_ip');
            $grid->column('login_date');
            $grid->column('openid');
            $grid->column('balance');
            $grid->column('nickname');
            $grid->column('avatar');
            $grid->column('name');
            $grid->column('sex');
            $grid->column('area_id');
            $grid->column('birthday');
            $grid->column('mark');
            $grid->column('point');
            $grid->column('tag_ids');
            $grid->column('level_id');
            $grid->column('experience');
            $grid->column('group_id');
            $grid->column('creator');
            $grid->column('updater');
            $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 MemberUser(), function (Show $show) {
            $show->field('id');
            $show->field('mobile');
            $show->field('password');
            $show->field('status');
            $show->field('register_ip');
            $show->field('register_terminal');
            $show->field('login_ip');
            $show->field('login_date');
            $show->field('openid');
            $show->field('balance');
            $show->field('nickname');
            $show->field('avatar');
            $show->field('name');
            $show->field('sex');
            $show->field('area_id');
            $show->field('birthday');
            $show->field('mark');
            $show->field('point');
            $show->field('tag_ids');
            $show->field('level_id');
            $show->field('experience');
            $show->field('group_id');
            $show->field('creator');
            $show->field('updater');
            $show->field('created_at');
            $show->field('updated_at');
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new MemberUser(), function (Form $form) {
            $form->display('id');
            $form->text('mobile');
            $form->text('password');
            $form->text('status');
            $form->text('register_ip');
            $form->text('register_terminal');
            $form->text('login_ip');
            $form->text('login_date');
            $form->text('openid');
            $form->text('balance');
            $form->text('nickname');
            $form->text('avatar');
            $form->text('name');
            $form->text('sex');
            $form->text('area_id');
            $form->text('birthday');
            $form->text('mark');
            $form->text('point');
            $form->text('tag_ids');
            $form->text('level_id');
            $form->text('experience');
            $form->text('group_id');
            $form->text('creator');
            $form->text('updater');
        
            $form->display('created_at');
            $form->display('updated_at');
        });
    }
}
