Skip to content

Instantly share code, notes, and snippets.


Matthias Gutjahr mattsches

View GitHub Profile
View luftdatenapi.php
* Class LuftdatenApi
class LuftdatenApi
const BASE_URL = '';
mattsches / configuration.yaml
Created May 8, 2017
Beispiel für RESTful Sensor in Home Assistant zur Abfrage des API
View configuration.yaml
- platform: rest
value_template: >
{% if value_json is sequence %}
{% set sensor = value_json | last %}
{% else %}
{% set sensor = value_json %}
{% endif %}
{% for sdv in sensor.sensordatavalues %}
View laravel facades

Found an example there is a thing in laravel called FormRequest. Sometimes, I need extra validation. So I need to use some service there somehow. What options I have

  1. facade
  2. service locator via app() global function
  3. I also have instance of container there via $this->container

which one is the best here? I suppose instance of container

I can't do constructor injection. Why? Because for me, it seams that there are too many arguments on the __construct method