Answer the question
In order to leave comments, you need to log in
How are the calculations done?
There are models user, order, data (order_data)
I do this:
$orders = $user->orders;
$orders->load('data');
// В модели Order
public function getStatusAttribute()
{
$this->attributes['status'] = null; // показал laravel что у меня есть этот атрибут (без этого не работате)
return $this->data->some_param; // (1)
}
// В контроллере
$orders = $user->orders;
$orders->load('data'); // (2)
foreach ($orders as $order)
$order->status;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question