Leabdalla
Leabdalla

Reputation: 656

laravel - use Request class or input class

In a restful controller, which class should I use to get passed variables?

$member->email = Input::get('email');
// or
$member->email = Request::get('email');

both options work for me, but whats the difference?

Upvotes: 6

Views: 3938

Answers (3)

JeffreyWay
JeffreyWay

Reputation: 1143

Input::get() is just a helper that maps to the Request class. It doesn't really matter which you use.

Upvotes: 11

dr.linux
dr.linux

Reputation: 752

With Laravel 3 i prefer to use:

$member->email = Input::get('email');

But with Laravel 4 I prefer to use:

$member->email = Request::get('email');

Please check the article:

http://net.tutsplus.com/tutorials/php/laravel-4-a-start-at-a-restful-api/

Upvotes: 0

Euan T
Euan T

Reputation: 2141

I believe that Request is preferred in the context of a restful controller.

Upvotes: 0

Related Questions