Ejemplo n.º 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);
     }
 }
Ejemplo n.º 2
0
 public function getTypetitleAttribute()
 {
     $return = CategoryType::where('id', $this->type)->first();
     return $return->title;
 }