mercredi 27 juillet 2016

How to get requests in update method in laravel 5.2

I'm trying to update the edited data using auto generated update method in the controller. I edited the data by following process (Reference)

Controller :

public function edit($id)
{
    $user = Usermd::find($id);
    return View::make('editcreate', compact('user'));
}

Route :

Route::get('/user/edit/{id}', 'CreateUser@edit');

View :


   
   {!! Form::input('submit', 'Update User') !!}


Above code is working fine for me, now i wanted to update the records.

Route :

Route::get('/user/update/{id}', 'CreateUser@update');

Controller :

 public function update(Request $request, $id)
    {
        //
        echo $request->u_name;
        echo $id;
    }

When i echo the request object in update method it does not showing anything and also returning the error

MethodNotAllowedHttpException in RouteCollection.php line 218:

Can anyone guide me where i'm wrong that i can fix this issue. Also i wanted to know the edit process is correct or i should search some better. I would like to appreciate if someone guide me. Thank You.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire