src/Services/SettingsManager.php line 8

  1. <?php
  2. namespace App\Services;
  3. use Symfony\Contracts\Translation\TranslatorInterface;
  4. class SettingsManager {
  5.     private $translator;
  6.     public function __construct(TranslatorInterface $ti)
  7.     {        
  8.         $this->translator $ti;
  9.     }
  10.     /**
  11.      * Retrieves a configs from database using its key
  12.      * @param string $clave The key of the configs
  13.      * @return mixed Tshe configs object, or null if the key doesn't exists
  14.      */
  15.     public function getValue($clave$locale null)
  16.     {
  17.         if ($locale)
  18.             return $this->translator->trans($clave,[],'settings',$locale);
  19.         return $this->translator->trans($clave,[],'settings');
  20.     }
  21. }