K
K
Karetski2015-04-30 20:55:28
RESTful API
Karetski, 2015-04-30 20:55:28

Laravel: What is the difference between Request::get(); and Input::get();?

In the process of learning Laravel, I came across the article code.tutsplus.com/tutorials/laravel-4-a-start-at-a...
It uses Request::get to collect data from a request; But in the Laravel documentation
laravel.com/docs/4.2/requests#request-information
, Input::get(); is used for this purpose, but there is no word about Request::get(), although I did not notice a difference experimentally.
Is there really no difference or am I wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
JhaoDa, 2015-04-30
@Karetski

Yes, there is no difference, both methods refer to

\Illuminate\Http\Request->get($key, $default, $deep);

M
Mikhail Osher, 2015-04-30
@miraage

<?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';
  }
}

<?php namespace Illuminate\Support\Facades;
/**
 * @see \Illuminate\Http\Request
 */
class Request extends Facade {
  /**
   * Get the registered name of the component.
   *
   * @return string
   */
  protected static function getFacadeAccessor()
  {
    return 'request';
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question