Search code examples
phplaravellaravel-5adminlte

Model Form with CRUD in Laravel 5 (Edit User)


I'm going to freak out, because I'm trying to get a "Edit User" form running but I keep getting this error:

Missing argument 2 for Collective\Html\FormBuilder::input(), called in D:\Apache24\htdocs\monitor\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 217 and defined (View: D:\Apache24\htdocs\monitor\resources\views\user\edit.blade.php)

That's the call in my edit.blade.php-View:

{{ Form::model($user, array('route' => array('User.edit', $user->id), 'method' => 'PUT')) }}

{{ Form::input('email') }}
{{ Form::input('name') }}

{{ Form::close() }

That's my method "edit" in my "UserController"

public function edit($id)
{
    $user = User::find($id);
    return view('user.edit', compact('user'));   //
}

I don't have an "update"-function yet. Just trying to get the model form.


Solution

  • Error says that you need to use two parameters: first is the type of input and second parameter is the name of form element:

    {{ Form::input('text', 'name') }}