I have a wierd problem - when updating a model's property that references a lookup table - the lookup table's row is changing.
I have an Orders Model that has a status_id property that references OrdersStatuses table. This allows me to get a workflow structure. > $this->hasOne( "status_id", "Models\Orders\OrdersStatuses", "id", ['alias'=>'status'] );
I also tried with 'belongsTo'
OrdersStatuses has an id, name and next_status, an id that references which OrdersStatuses is next.
> $next_status = OrdersStatuses::findFirst($order->status->nex\t_status);
> $order->status_id = $next_status->id;
This changes the OrdersStatuses table's data:
Ex with the following: orders_statuses > id | name | next_status
> 1 | Paid | 2
> 2 | Ready | 3
> 3 | Delivered| 4
orders >id | status_id
>1 | 1
this would change orders.status\id to 2, BUT it will also change orders_status: >id | name | next_status
>1 | Ready | 2
>2 | Ready | 2
>3 | Delivered| 4
Its changing the destination row's name to the previous name, and the next_status. What am i doing wrong?