Request::get PHP Method

get() public static method

This method is mainly useful for libraries that want to provide some flexibility. If you don't need the flexibility in controllers, it is better to explicitly get request parameters from the appropriate public property instead (attributes, query, request). Order of precedence: PATH (routing placeholders or custom attributes), GET, BODY
public static get ( string $key, mixed $default = null ) : mixed
$key string the key
$default mixed the default value if the parameter key does not exist
return mixed
        public static function get($key, $default = null)
        {
            //Method inherited from \Symfony\Component\HttpFoundation\Request
            return \Illuminate\Http\Request::get($key, $default);
        }

Usage Example

Example #1
0
 /**
  * Update or creates a 'Calle' as from the resquest data, and return the id.
  *
  * @param  Request  $request
  * @return int
  */
 protected function getCalleIdAsociado($request)
 {
     $nombre_calle = strtolower($request->get('nombre_calle'));
     // Intento buscar la calle, si no existe entonces la creo.
     $calle = Calle::firstOrCreate(['nombre' => $nombre_calle, 'localidad_id' => $request->get('localidad_id')]);
     return $calle->id;
 }
All Usage Examples Of Request::get