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 Laravel 4 Basics Blade & Forms Recieving Input

Greg Kaleka
Greg Kaleka
39,021 Points

[Solved] Laravel 5.1 error: Class 'App\Http\Controllers\Input' not found

In this video, Hampton writes the code:

TodoListController.php
<?php

//...

public function store()
{
    return Input::all();
}

In Laravel 5.1, this returns an error of

FatalErrorException in ToDoListController.php line 38:
Class 'App\Http\Controllers\Input' not found

2 Answers

Greg Kaleka
Greg Kaleka
39,021 Points

Hey, I figured this out:

Looking at the docs for HTTP Requests in 5.1, it seems you need to change the return line to this:

TodoListController.php
<?php

//...

public function store(Request $request)
{
    return $request->input();
}

That's certainly the better way of doing it! I'm surprised the Input facade didn't work for you, perhaps because 'Input' wasn't imported at the top of the class? But yes! Do it they way you're doing it.

Greg Kaleka
Greg Kaleka
39,021 Points

Thanks Tom,

I actually just went through this course again, creating a different app, and was able to use the Input facade... I think I may have needed to add use Input to the file. I'm still a bit shaky on what Laravel 5.x requires in that regard.

I've seen you around the Laravel questions here in the forum, always with good advice - do you work in tech / with Laravel? You certainly seem to know your stuff!

Cheers,

-Greg

That sounds about right!

I've done a few projects in Laravel, but I'm a general front end/php developer 9-5. Thanks man :)

jason chan
jason chan
31,009 Points

I would just watch videos from laracasts.com the instructor sounds way more nerdy. LOLs.