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()
    {
        return [
            'rankcode' => [
                'required',
            ],
            'unitcode' => [
                'required',
            ],
            'lastname' => [
                'required',
            ],
            'firstname' => [
                'required',
            ],
            'middlename' => [
                'required',
            ],
            'email' => [
                'required', 'email', Rule::unique((new User)->getTable())->ignore($this->route()->user->id ?? null)
            ],
            'password' => [
                $this->route()->user ? 'nullable' : 'required', 'confirmed', 'min:6'
            ]
        ];
    }
public function rules ( ) { return [ 'rankcode' => [ 'required' , ] , 'unitcode' => [ 'required' , ] , 'lastname' => [ 'required' , ] , 'firstname' => [ 'required' , ] , 'middlename' => [ 'required' , ] , 'email' => [ 'required' , 'email' , Rule :: unique ( ( new User ) -> getTable ( ) ) -> ignore ( $ this -> route ( ) -> user -> id ?? null ) ] , 'password' => [ $ this -> route ( ) -> user ? 'nullable' : 'required' , 'confirmed' , 'min:6' ] ] ; }
Get the validation rules that apply to the request.
Get the validation rules that apply to the request .