greaterThan($contract->date_expired)) { //Delete the contract PublicContract::where([ 'id' => $contract->id, ])->delete(); //Delete the items from the contract from the other table PublicContract::where([ 'contract_id' => $contract->id, ])->delete(); } } } }