mardi 29 août 2017

Laravel create custom method to get form data

How do I make custom method to get form data? I want this method same with Laravel update method with parameters request and id. I try this but get error.

In controller

public function updatePassword(Request $request, int $id) {
   dd($request->all());
}

In route

Route::post('staffs/{id}/upassword', 'Admin\StaffController@updatePassword')->name('admin.staffs.upassword');

In blade file

<form method="post" accept-charset="utf-8" action="">
    <div class="row">
        <div class="col-md-3">
            <div class="form-group">
                <label class="control-label" for="password">New Password</label>
                <input class="form-control" name="password" type="password">
            </div>
       </div>
   </div>
   <div class="row">
       <div class="col-md-3">
           <div class="form-group">
               <label class="control-label" for="password_confirmation">Confirm New Password</label>
               <input class="form-control" name="password_confirmation" type="password">
           </div>
       </div>
  </div>

  <input class="btn btn-primary" type="submit">
</form>

I am using Laravel 5.4.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire