slug = Str::slug($item->name); }); } public function recipe() { return $this->belongsTo(Recipe::class, 'id'); } public function getQuantityAttribute() { if ($this->pivot) { return $this->pivot->quantity; } return null; } }