Example #1
0
 /**
  * @internal param $generatedRecords
  */
 private function createMenuEntry()
 {
     $records = \Modules\Page\Entities\Page::where('published', 1)->take(3)->get();
     if ($main = Menu::root()->where(['name' => 'Main'])->first()) {
         foreach ($records as $element) {
             $main->children()->create(['name' => $element['title'], 'url' => "page/{$element['slug']}", 'active' => true]);
         }
     }
 }
Example #2
0
 /**
  * Handle the event.
  *
  * @param PageWasCreated $event
  */
 public function pageHandle($event)
 {
     $page = Page::firstOrNew(['id' => $event->pageId]);
     $this->saveDynamicData($page, $event->data);
 }
Example #3
0
 /**
  * Handle the event.
  *
  * @param PageWasUpdated $event
  */
 public function pageHandle($event)
 {
     $page = Page::find($event->pageId);
     $this->saveDynamicData($page, $event->data);
 }