I don't really understand how i can use variable from controller in model?
public function getPostsTotalSumAttribute($start)
{
return $this->hasOne('invoiceRows','productId','id')->selectRaw('productId, sum(amount*quantity) as postsTotalSum')->where('created_at','>=',$start)->groupBy('productId')->orderBy('taxPercent','ASC');
}
How i can set $start variable in controller?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community