public function destroy(Request $request) { $delete_items = $request->input('delete_items'); if (count($delete_items) > 0) { $query = $this->category->whereIn('id', $delete_items); $query->delete(); } \Flash::success(trans('message.entity_deleted', ['entity' => trans('models.category')])); return redirect()->route('admin.categories.index'); }
/** * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function categories() { return $this->hasMany(Category::getClass(), 'category_link'); }
function category_list() { $categories = Category::orderBy('name', 'asc')->lists('name', 'id')->toArray(); $categories = ['' => 'None'] + $categories; return $categories; }