Ejemplo n.º 1
0
 /**
  * Hydrate modules with data from storage record.
  *
  * @param  Storage $storage
  * @return void
  */
 public function hydrate(Storage $storage)
 {
     // Extract the module data from storage.
     $modules = $storage->getData();
     // Iterate module data.
     foreach ($modules as $slug => $module) {
         // Get live module from profiler.
         $m = $this->profiler->getModule($slug);
         // Set module data from storage.
         $m->setData(array_get($module, 'data'));
         $m->setGlobal(array_get($module, 'global'));
         $m->setBadge(array_get($module, 'badge'));
     }
 }
Ejemplo n.º 2
0
 /**
  * Clear all storage records.
  *
  * @return void
  */
 public function clear()
 {
     // Iterate models.
     Storage::get()->each(function ($model) {
         // Delete model.
         $model->delete();
     });
 }