php - Laravel 5 Eloquent ORM -


hi have problem code.

this view

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

this controller (only method index use

public function index() {      $todo_lists = todolist::all();    return view('todos/index')->with('todo_lists', $todo_lists);  }  public function create() {  return "create new list"; } 

this model

class todolist extends eloquent{    protected $tabel = 'todo_lists'; } 

i have database todo_lists table have information id , name want display. th view returns me blank page. seems problem in controller in $todo_lists = todolist::all();. me please?

you can try :

public function index() {     $todo_lists = todolist::all();     // send variables view, use compact('var1', 'var2',...)     return view('todos/index', compact('toto_lists')); } 

if want send flash message:

return redirect('user/login')->with('message', 'login failed'); 

check: http://laravel.com/docs/5.0/responses#redirects


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -