belongsTo('App\Category'); } public function shelf() { return $this->belongsTo('App\Shelf'); } public function transactions() { return $this->hasMany('App\Transaction'); } public function scopeAvailable($query) { return $query->where('stock', '>', 0); } public function scopeOrderByTitle($query) { return $query->orderBy('title'); } }