Esempio n. 1
0
 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');
 }
Esempio n. 2
0
 /**
  * @return \Illuminate\Database\Eloquent\Relations\HasMany
  */
 public function categories()
 {
     return $this->hasMany(Category::getClass(), 'category_link');
 }
Esempio n. 3
0
function category_list()
{
    $categories = Category::orderBy('name', 'asc')->lists('name', 'id')->toArray();
    $categories = ['' => 'None'] + $categories;
    return $categories;
}