Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialkrs dino
Courses Plus Student 778 Pointsissues with the Eloquent Chapter
getting and error when i insert this code
<?php
class TodoListController extends \BaseController {
public function index()
{
//
$contact = TodoList::all();
return View::make('todos.index')->with('contact', $contact);
}
my table is "contact" and i get error on running this...what could be the problem
2 Answers
krs dino
Courses Plus Student 778 Pointsno worries on it again.....what wasn't mentioned in this lesson is that laravel use Plural naming for table so even when you use a singular naming it automatically adds a "S" in your table name so in order to solve this its either you use a Plural naming convention for your table or you Over-write the Plural table naming in larval
Andrew Shook
31,709 PointsCould you please post the TodoList model code. I'm guessing you need to change the model's table property to contact.
protected $table = 'contacts';
By convention, Laravel models look for a plural from of there models name. I.e The User model will look in the "users" table. You can override that by telling the model to use a specific table.