vendredi 12 août 2016

How to update laravel 5.2 user edit form by using patch method

I am following laravel tutorial by jeffrey. But I have got a problem with while update the form. I'm getting all form fields but when updating it is showing that page not found. I have tried many multiple what jeffrey told how to updating form in 5.2

http://ift.tt/1C6au2N

<form action="form/" method="POST">

        <label for="name">Name</label>
        <input type="text" name="name" value="">
        <label for="email">Email</label>
        <input type="text" name="email" value="">

        <label for=""></label>
        <input type="submit" value="Submit" name="submit">
    </form>

this is routes
Route::get("form/{id}/edit", "you@edit");
Route::patch("form/{user}", "you@update");

This is my controller 

public function edit($id)
    {
        $user = laravel::findorfail($id);
        return view("form", compact("user"));
    }

    public function update(Request $request, User $user)
    {
        $user->update($request->all());
    }

Thank you in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire