Ejemplo n.º 1
0
 public function indexTypes()
 {
     $company = Auth::user()->company;
     $parents = Category::get();
     $categories = $parents->toTree();
     $dep = '-';
     return view('account.settings.work.types')->with(compact('categories', 'parents', 'dep', 'company'));
 }
 /**
  * @param $category
  * @param null $subcategory
  * @return $this|\Illuminate\Http\Response
  */
 public function show($category, $subcategory = null)
 {
     if ($subcategory != null) {
         try {
             $cat = PrsoCategory::withDepth()->where('slug', '=', $subcategory)->having('depth', '=', 1)->first();
             if (!$cat) {
                 throw new \Exception();
             }
             return view('categories.category')->with(['companies' => $cat->companies()->published()->paginate(5)]);
         } catch (\Exception $e) {
             return response()->view('errors.' . '503');
         }
     } else {
         try {
             $cat = PrsoCategory::withDepth()->having('depth', '=', 0)->where('slug', '=', $category)->first();
             if (!$cat) {
                 throw new \Exception();
             }
             return view('categories.index')->with(['categories' => $cat->children, 'parent' => $cat->slug]);
         } catch (\Exception $e) {
             return response()->view('errors.' . '503');
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Show the application dashboard.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $categories = PrsoCategory::withDepth()->having('depth', '=', 0)->get()->toTree();
     $subHeadsCategories = PrsoCategory::get()->toTree();
     return view('welcome')->with(compact(['categories', 'subHeadsCategories']));
 }
 /**
  * @param Request $request
  * @param $keyword
  * @return \Illuminate\Http\JsonResponse
  */
 public function search(Request $request, $keyword)
 {
     $categories = Category::SearchByKeyword($keyword)->get()->toTree();
     return response()->json($categories);
 }