Ejemplo n.º 1
0
 public function __construct()
 {
     $this->site_infos = Site_infos::first();
     $this->destination = Country::select('id', 'name', 'url')->where('status', 'Active')->get();
     $this->menu = Page::where('status', 'Active')->where('parent_id', 0)->where('status', 'Active')->get();
     /**
      * find parent id on the menu and concatenate related sub menu to Array
      * */
     foreach ($this->menu as $key => $m) {
         $this->menu[$key]->sub_menu = Page::where('parent_id', $m->id)->where('status', 'Active')->get()->toArray();
     }
     /**
      * find the country related category
      */
     foreach ($this->destination as $key => $d) {
         $this->destination[$key]->category = category::select('name', 'url')->where('country_id', $d->id)->where('status', 'Active')->get()->toArray();
     }
 }