Laravel 5 Eloquent ORM

Hi i have a problem with this code.

This is the view

@extends('layouts.main')
@section('content')
<h2>All Todo Lists</h2>
<ul>
<?php
@foreach ($todo_lists as $list)
<li>{{$list->name}}</li>
@endforeach
?>
</ul>
@stop

This is the controller (only method index that i actually use

public function index()
{

    $todo_lists = TodoList::all();
   return view('todos/index')->with('todo_lists', $todo_lists);

}

This is the model

class TodoList extends Eloquent{}

I have a database with todo_lists table which have some information like id and name that i want to display. But actually th view returns me a blank page. It seems that the problem was in the controller in $todo_lists = TodoList::all();. Anyone could help me please?


Source: php

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.