Beispiel #1
0
 public function normal($navbar_id, $parent_id, $child_id)
 {
     $navbar = Navbar::get();
     $list = Category::getChild($parent_id);
     if (isset(Auth::user()->id)) {
         $contact = DB::table('contact')->where('user_id', Auth::user()->id)->get();
     } else {
         $contact = "non";
     }
     return view('web.normal')->with('navbar', $navbar)->with('navbar_id', $navbar_id)->with('parent_id', $parent_id)->with('child_id', $child_id)->with('list', $list)->with('active_id', $child_id)->with('contact', $contact);
 }
Beispiel #2
0
 public static function get()
 {
     $result = DB::table('navbar')->join('category', 'category.id', '=', 'navbar.parent_id')->select('navbar.id', 'navbar.parent_id', 'category.name')->get();
     for ($i = 0; $i < count($result); $i++) {
         $child = Category::getChild($result[$i]->parent_id);
         if ($child) {
             $result[$i]->child_id = $child[0]->child;
             $result[$i]->child_name = $child[0]->name;
         } else {
             $result[$i]->child_id = 'null';
             $result[$i]->child_name = 'null';
         }
     }
     return $result;
 }
 public function getChild($parent_id)
 {
     $result = Category::getChild($parent_id);
     return $result;
 }