public function clearRedundant()
    {
        Promocode::all()->each(function (Promocode $promocode) {
            if ($promocode->isExpired() || ($promocode->isDisposable() && $promocode->users()->exists())) {
                $promocode->users()->detach();
                $promocode->delete();
            }
        });
    }
public function clearRedundant()
    {
        Promocode::all()->each(function (Promocode $promocode) {
            if ($promocode->isExpired() || ($promocode->isDisposable() && $promocode->users()->exists())) {
                $promocode->users()->detach();
                $promocode->delete();
            }
        });
    }
public function clearRedundant ( ) { Promocode :: all ( ) -> each ( function ( Promocode $ promocode ) { if ( $ promocode -> isExpired ( ) || ( $ promocode -> isDisposable ( ) && $ promocode -> users ( ) -> exists ( ) ) ) { $ promocode -> users ( ) -> detach ( ) ; $ promocode -> delete ( ) ; } } ) ; }
Clear all expired and used promotion codes
that can not be used anymore.

@return void
Clear all expired and used promotion codes that can not be used anymore .