Example #1
0
 /**
  * Set translations .
  *
  * @return $this
  */
 public function setTranslations()
 {
     $locales = $this->getLocales();
     $translations = [];
     foreach ($locales as $locale => $options) {
         $path = $this->getFileFullPath($locale);
         $contents = Support\get_file_contents($path);
         $translations[$locale] = $contents;
     }
     $this->translations = $this->loaded = $translations;
     return $this;
 }
Example #2
0
 /**
  * Set settings .
  *
  * @return mixed
  */
 public function init()
 {
     $attributes = $this->getAttributes();
     $fullPath = storage_path($attributes['path']);
     if (Support\is_path_exists($fullPath)) {
         $this->settings = Support\get_file_contents($fullPath);
     } else {
         Support\dump_file($fullPath, json_encode([]));
     }
     register_shutdown_function(function () use($fullPath) {
         Support\dump_file($fullPath, $this->packData($this->settings));
     });
 }