where('active', '=', 1)->where('expires_on', '<', $current)->get(); foreach ($warnings as $warning) { // Set Records Active To 0 in warnings table $warning->active = '0'; $warning->save(); // Send Private Message $pm = new PrivateMessage(); $pm->sender_id = 1; $pm->receiver_id = $warning->warneduser->id; $pm->subject = 'Hit and Run Warning Deactivated'; $pm->message = 'The [b]WARNING[/b] you received relating to Torrent '.$warning->torrenttitle->name.' has expired! Try not to get more! [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]'; $pm->save(); } } }