I have an order_status_transaction table which is a log table for recording the status of transactions
I am trying to write an eloquent builder to get all of the transactions with a CURRENT status of 5 for example.
This is the closest I have got
$transactions = $this->whereHas('statuses', function ($query) use ($statusId) {
$query->where('order_status_transaction.order_status_id', $statusId)->where();
});
But it does not check if it is the most recent. I don't want to get the collection and filter the collection, can this be going purely in a builder?
via Chebli Mohamed

Aucun commentaire:
Enregistrer un commentaire