app/Providers/AppServiceProvider.php
/**
     * Bootstrap any application services.
     *
     * @return void
     */
Bootstrap any application services.
@return void
Bootstrap any application services . @return void
public function boot()
    {
        $jual = tbljual::where('status','1')->get();
        foreach($jual as $p){
            $date1 = new \DateTime($p->tglpesan);
            $date2 = new \DateTime(date('Y-m-d H:i:s'));
            $interval = $date1->diff($date2);
            if($interval->h >= 4){
                tbljual::where('idjual',$p->idjual)->update(['status'=>'5']);
            }
        }
    }
public function boot ( ) { $ jual = tbljual :: where ( 'status' , '1' ) -> get ( ) ; foreach ( $ jual as $ p ) { $ date1 = new \ DateTime ( $ p -> tglpesan ) ; $ date2 = new \ DateTime ( date ( 'Y-m-d H:i:s' ) ) ; $ interval = $ date1 -> diff ( $ date2 ) ; if ( $ interval -> h >= 4 ) { tbljual :: where ( 'idjual' , $ p -> idjual ) -> update ( [ 'status' => '5' ] ) ; } } }
Bootstrap any application services.
Bootstrap any application services .