<?php  namespace  App\Http\Requests\Manager;

use App\Http\Requests\BaseRequest;

/**
 * 管理后台平台
 * @author  jun
 *
 * */
class Company extends BaseRequest{

    /**
     *
     * @return  array
     */
    public  function  rules(){
        return [
            'id'                =>  'required|integer|gt:0',
            'name'              =>  'required|unique:company,name,'.request('id',0),
            'category_id'       =>  'required|integer|gt:0',
            'username'          =>  'required',
            'phone'             =>  'required|phone',
            'password'          =>  'required',
        ];
    }
    // 场景列表
    protected   $scenes         = [
        'add'  		            => ['name','category_id','username','phone','password'],
        'edit'  		        => ['id','category_id','username','phone'],
        'set_status'  		    => ['id'],
    ];
    /**
     *
     * @return  array
     */
    public  function  messages(){
        return [
            'name.required'         => '商户名称必填',
            'name.unique'	        => '商户名称已经存在',
            'category_id.required'  => '请选择类目',
            'id.required'           => 'ID未知',
            'id.integer'            => 'ID格式错误',
            'id.gt'   		        => 'ID格式错误',
            'username.required'     => '管理员名称必填',
            'phone.required'        => '管理员手机号必填',
            'phone.phone'           => '管理员手机号格式错误',
            'password.required'     => '管理员密码必填',
        ];
    }

}
