make(Illuminate\Contracts\Console\Kernel::class); $kernel->bootstrap(); $user = \App\Models\User::find(2); $driver = $user->driver; // Pretend the shift started yesterday $driver->update([ 'shift_started_at' => now()->subDay(), 'shift_ends_at' => now()->subHours(1), ]); // Run the middleware logic $earnings = \App\Models\TripLog::where('driver_id', $user->id) ->where('started_at', '>=', $driver->shift_started_at) ->sum('total_fare'); $pendingRemittance = $earnings > 0; dump("Earnings: " . $earnings); dump("Pending Remittance: " . $pendingRemittance);