mardi 3 novembre 2015

Multiple forms in one page in Laravel 5.1

I have one blade page has one form to update and another one to save

my question How i can submit both according to method type

I tried to achieve that like the following example

 public function postCompanyProfileSettings(Request $request)
 {

    if($request->isMethod('POST')) {
          // do something to save
      }
     if($request->isMethod('PUT')) {
        // do something to update 
     }
 }

it's working well with POST method but with PUT return Route Exception MethodNotAllowedHttpException in RouteCollection.php line 219:

I think that the issue in routs.php but i don't know what exactly to do to handle one route for multiple forms (multiple methods)

My route in route.php file

  //setting routes...
 get('/home/settings', 'CompanyProfileController@getCompanyProfileSettings');
 post('/home/settings','CompanyProfileController@postCompanyProfileSettings');

Do there is any way to achieve that?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire