Example #1
0
 public function getCategoryOptions()
 {
     $options = Category::all(['id', 'title'])->toArray();
     foreach ($options as $option) {
         $categoryArray[$option['id']] = $option['title'];
     }
     return $categoryArray;
 }
Example #2
0
 public function index_onDelete()
 {
     if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
         foreach ($checkedIds as $catId) {
             if (!($cat = Category::find($catId))) {
                 continue;
             }
             $cat->delete();
         }
         Flash::success('Successfully deleted category(ies).');
     }
     return $this->listRefresh();
 }
Example #3
0
 public function getCategory()
 {
     $id = (int) $this->property('category');
     $category = Category::get()->where('id', $id)->first();
     return $category;
 }