Level 122
if($modelsCreatedAfterLastTimeFocused = Model::where('created_at','>',$lastTime)->exists()) {
// there are some new records
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
in my react native app, when app goes to background I store a timestamp on my data store, then when my app goes to foreground I fire a post call with the stored timestamp in order to check if any of Model where created after timestamp.
How can I use laravel query builder to do that?
Should I use Carbon to format the javascript datetime first?
let lastTimeScreenFocused = new Date();
//then after some time I do the backend request and want to check if any new Model was created after lastTimeScreenFocused
$modelsCreatedAfterLastTimeFocused = false;
$modelsCreatedAfterLastTimeFocused = Model::where('created_at')->first();
Please or to participate in this conversation.