Beispiel #1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($type = null)
 {
     $this->layout = 'categories.index';
     $this->metas['title'] = trans('project.categories');
     $this->view = $this->BuildLayout();
     if ($type == null) {
         $categoryTypes = CategoryType::all();
         return $this->view->withCategoryTypes($categoryTypes);
     } else {
         $typId = CategoryType::where('slug', $type)->first()->id;
         $categories = Category::where('type', $typId)->orderBy('position')->get();
         return $this->view->withCategories($categories);
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $types = CategoryType::all();
     return Response::json($types, 200);
 }