check dattime withing 24 hours in php carbon code example
Example 1: carbon now format
use Carbon/Carbon
Carbon::now()->format('Y-m-d H:i:s');
Example 2: carbon subdays
$users = Users::where('status_id', 'active')
->where( 'created_at', '>', Carbon::now()->subDays(30))
->get();