mardi 10 octobre 2017

Laravel FormRequest get input value

I try to use FormRequest:

class RegistrationForm extends FormRequest
{
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        return [
            'name'=>'required',
            'email'=>'required|email',
            'password'=>'required|confirmed'
        ];
    }

    public  function persist(){
        $user=new User();
        $user->name=$this->only(['name']);
        $user->email=$this->only(['email']);
        dd($this->only(['password']);
        auth()->login($user);
    }
}

I need get in persist() method inputs value from my requst. I tried to get 'password' value, but I got array. How can I get input value like a string?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire