Just wondering what is the difference between:
$username = $request->input('username');
and
$username = Input::get('username');
There is no difference, the facade Input calls the input method from request. But Input::get
is deprecated, prefer the $request->input
instead of Input::get
<?php
namespace Illuminate\Support\Facades;
/**
* @see \Illuminate\Http\Request
*/
class Input extends Facade
{
/**
* Get an item from the input data.
*
* This method is used for all request verbs (GET, POST, PUT, and DELETE)
*
* @param string $key
* @param mixed $default
* @return mixed
*/
public static function get($key = null, $default = null)
{
return static::$app['request']->input($key, $default);
}
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'request';
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With