public function scopePurposes() { foreach (Purpose::all() as $purpose) { } $inventory = Bullet::where('cartridge_id', $this->id)->select(DB::raw('SUM(`inventory`) as inventory, purpose_id'))->groupBy('purpose_id')->get(); }
public function showManufacturers($manufacturer) { return view('bullets.index', ['cartridges' => Cartridge::all(), 'bullets' => Bullet::where('manufacturer', $manufacturer)->get(), 'sort' => 'inventory']); }