Пример #1
0
 public function getCategoryOptions()
 {
     $options = Category::all(['id', 'title'])->toArray();
     foreach ($options as $option) {
         $categoryArray[$option['id']] = $option['title'];
     }
     return $categoryArray;
 }
Пример #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();
 }
Пример #3
0
 public function getCategory()
 {
     $id = (int) $this->property('category');
     $category = Category::get()->where('id', $id)->first();
     return $category;
 }