Closed MRGAO-CR7 closed 3 years ago
Can you define what you mean by "accessor" for a resource? If you could provide an example of how it would look using Eloquent's database query builder that would help.
Just added an accessor into the Model,
public function getOnHandAttribute()
{
return $this->stocks()->sum('amount');
}
the link you can read, https://laravel.com/docs/8.x/eloquent-mutators#defining-an-accessor
Ok, yeah wasn't sure what you meant by sorting by it.
I'm going to close this issue for now as I don't think there's anything I need to do.
@here @lindyhopchris