I have an array of model entities, each one has a used_at carbon timestamp, I was wondering how can I retrieve the last model to be used (latest used_at) timestamp of the record of models.
$models = Model::all();
How can I get the last used model with Eloquent?
Model::latest('used_at')->first();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.