php - laravel 4-call_user_func_array() -


I am trying to insert some data into the database. I have created a form with all the fields and controllers. CarController.php

  create a public function () {// Load form of form (App / view / page / create.blood.fp) See refund :: create ('pages.create'); } Public Function Store () {// store $ data = New car; $ Data- & gt; Id = input :: find ('id'); $ Data- & gt; Save (); // Restore session: Flash ('Message', 'Successfully Data Created!'); Redirect Return: From ('Page / Car'); }   

routes.php

  Root :: processing ('car', 'car controller'); Root :: post ('desc', array ('use' => 'showcountryr @ show')); Root :: Post ('Create', array ('Use' => 'Creating Car Controller')); Root :: post ('store', array ('store' => 'cartrontroller @ store'));   

create.blade.php

  {{form :: open (array ('url' = & gt; 'store', 'class' = & Gt; form-horizontal '))}} & lt; Div class = "form-group" & gt; {{Form: Label ('id', 'vehicle id', array ('class' = & gt; 'control-label call-LG-4'))}} < Div class = "col-lg-8" & gt; {{Form :: text ('id', input :: old ('text id'), array ('class' => 'form-control', 'placeholder' => 'vehicle id'))} } And lieutenant; / Div & gt; & Lt; / Div & gt; {{FORM: Submit ('Create Car!', Array ('class' = & gt; 'BTN BTN-Primary'))}}   

The problem is that it shows the following error: Hopefully the criteria 1 is a valid callback, no array or string is given I do not know What have I done because I am new to Larval

You are using a resource controller and this The reason is that you only need a root declaration for it, such as:

  Root :: processing ('car', 'car controller');   

You have also declared the following routes:

  Route: post ('desc', array ('uses' =>' controller @ Show' )); Root :: Post ('Create', array ('Use' => 'Creating Car Controller')); Root :: post ('store', array ('store' => 'cartrontroller @ store'));   

In fact you do not need these root announcements, only use the first route and it will make way for your resource controller. For example, your route will look like this:

  method | Url | Action | Get the name of the root -------------------------------------------- | / Car / making | Make it | Create GET POST using cars.create // domain.com/cars/. / Car | Store |   

is more, you should check using cars.store // domain.com/cars POST. In this case, you have two methods in your controller and if you use url like yourdomain.com/cars/create then GET Method (if you navigate through the browser's address bar), then it will apply the create method and if you select form by POST method. send your domain .com / car then it will apply the store method and all your form fields $ _ POST Array And the value of the ID field to get you the input: get ('id') . Check documentation for more information.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -