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 trial

PHP

BadMethodCallException in compiled.php line 8295: Method [all] does not exist.

Hi, I am adding the following line of code to my controller file, and I keep on receiving the above error (title of this post).

<?php

//TodoListController.php

public function index()
    {
        $todo_lists = TodoListController::all();
        return View::make('todos.index')->with('todo_lists', $todo_lists);
    }

Please help!!

Robert

MOD: edited to format code

2 Answers

Great, I think my line of code $todo_lists = TodoListController::all(); was meant to say $todo_lists = TodoList::all();, and then I ran into a different problem, where I got the message 'Class 'App\TodoList' not found'. I then had to add the two lines of code

use app\User;

use app\TodoList;

to the top of my controller file, and reference the line: $todo_lists = \App\TodoList::all();

This worked!!

Thanks,

Rob

It is saying that the all() method on this line does not exist:

<?php

TodoListController::all()