Support the ongoing development of Laravel.io →
Views Blade Forms

I seem to be having an issue using Form::model My controller looks like: in

	public function edit(Todo $todoInst)
	{
		$todos = Todo::all();
		return view('todo.edit', compact('todos', 'todoInst'));
	}

The $todoInst is bound to the route, and is working properly if I dd($todoInst) in the controller or just {{ $todoInst }} in the view. So, my view for todo.edit looks like:

@extends('app')

@section('content')

    <div class="container-fluid">
        <div class="row">
            <div class="col-md-3">
                <ul class="list-group">
                    @if (!count($todos))
                        <li class="list-group-item">No todos.</li>
                    @else
                        @foreach ($todos as $todo)
                            <li class="list-group-item">
                                <a href="{{ route('todo.show', ['todo' => $todo->id]) }}">{{ $todo->desc }}</a>
                            </li>
                        @endforeach
                    @endif
                </ul>
            </div>

            <div class="col-md-9">

                {{ Form::model($todoInst, array('route' => array('todo.update', $todoInst->id))) }}
                    hi
                {{ Form::close() }}

            </div>
        </div>
    </div>

@endsection

Finally, if I php artisan route:list in the terminal, todo.update does indeed exist. The routes are set up with Route::resource('todo', 'TodoController') and again, the artisan route:list does show all routes for that controller. If I remove the Form::model and Form::close() from my view it loads fine, leaving it in causes a white screen. Nothing is visible in /var/log/nginx on the homestead box. Grateful for any ideas, pretty new to Laravel so I'm in a bit of a jam.

Last updated 3 years ago.
0

Ah, I see the issue, seems the html and form helpers are not enabled by default, as per http://laravel.io/forum/09-20-2014-html-form-class-not-found-in-laravel-5

0

Sign in to participate in this thread!

Eventy

Your banner here too?

ggoforth ggoforth Joined 6 Feb 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.