0

I apologize if this is just a misunderstanding on my part in how to use Laravel.

I'm learning Laravel and I'm building a small application, however, I try to make a form in a view to pass data to a Controller but I get the following message.

ErrorException
Action App\Http\Controllers\clientesController@confirmarEdit not defined. (View: (redacted)\laravel\resources\views\clientesEditar.blade.php)

This method is indeed defined in clientesController, where all the others controllers are defined and work:

public function confirmarEdit($id)
{
    ...
}

I'm using the LaravelCollective package to use forms, following the documentation which states I can use pass form data to Controllers, I'm calling this method using a View, this way:

<!DOCTYPE html>
<html>
  <head>
    <title>Modificar Cliente {{ $cliente[0]->id }}</title>
  </head>
  <body>
    <ul>
      {{Form::open(['action' => ['clientesController@confirmarEdit', $cliente[0]->id]])}}
      Nombre: {{ Form::text('cnom', $cliente[0]->nombre)}}
      Apellido: {{ Form::text('cape', $cliente[0]->apellido)}}
      Empresa: {{ Form::text('cnom', $cliente[0]->empresa)}}
      <input type="submit" value="Editar">
      {{Form::close()}}
  </body>
</html>

Calling the method from a Route works, but not if I call it from a view, what am I doing wrong?

Thank you in advance.

Gabriel I.
  • 123
  • 13
  • Do you need to pass the `id` parameter? From the action definition it does not look optional... – War10ck Jul 27 '17 at 20:03
  • You're right, I need to pass the id parameter, while testing I removed it from the form:open() method to test and I forgot to add it back. I edited the OP to reflect the proper flow. – Gabriel I. Jul 27 '17 at 20:05

2 Answers2

0

Try this:

{ !! Form::open(array('action' => "clientesController@confirmarEdit", $cliente[0]->id)) !!  }
Godiez
  • 69
  • 1
  • 10
0

I think you can try this:

{!! Form::open(array('action' => "clientesController@confirmarEdit", $cliente[0]->id)) !!}

Hope this work for you !!!

AddWeb Solution Pvt Ltd
  • 21,025
  • 5
  • 26
  • 57