dimanche 29 janvier 2017

How to execute certain function after some time?

I have this function where user can reject other user.

 public function rejectPersonalUser($id){
        $user = PersonalUser::findOrFail($id);
        $user->approved = 0;
        $user->business_user_id = NULL;
        $user->save();

        return redirect()->back()->withFlashMessage('User has been rejected successfully!!');
   }

Now what i want is to check if user reject other user after 7 days if its not to call other function.

   public function setUser($id){
    $user = PersonalUser::findOrFail($id);
     if($user->approved == 0 && $user->business_user_id != NULL){
        $user->approved = 0;
        $user->business_user_id = NULL;
        $user->save();
    }
 }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire