app/Http/Requests/UserRequest.php
/**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
Get the validation rules that apply to the request.
@return array
Get the validation rules that apply to the request . @return array
public function rules()
    {
        $user = $this->route('user') ? $this->route('user')->id : 'NULL';
        return [
            'name'          => 'sometimes|string|max:255',
            'email'         => 'required|email|max:255|unique:users,email,' . $user,
            'lang'          => ['sometimes', Rule::in(array_keys(LaravelLocalization::getSupportedLocales()))],
            'role'          => ['required', new EnumValue(UserType::class, false)],
        ];
    }
public function rules ( ) { $ user = $ this -> route ( 'user' ) ? $ this -> route ( 'user' ) -> id : 'NULL' ; return [ 'name' => 'sometimes|string|max:255' , 'email' => 'required|email|max:255|unique:users,email,' . $ user , 'lang' => [ 'sometimes' , Rule :: in ( array_keys ( LaravelLocalization :: getSupportedLocales ( ) ) ) ] , 'role' => [ 'required' , new EnumValue ( UserType :: class , false ) ] , ] ; }
Get the validation rules that apply to the request.
Get the validation rules that apply to the request .
//unique:table,column,except,idColumn