addAgreementCheckbox(); } public static function addAgreementCheckbox() { if (isModuleActive('RegistrationFormSteps')) { $path = module_path('RegistrationFormSteps', 'Resources/views/customer/steps/_summary.blade.php'); if (file_exists($path)) { $update = false; $content = file_get_contents($path); if (!preg_match("/@include\('registrationagreement::components\.agreement_checkbox'\)/", $content)) { $matches = null; preg_match("/@include\('registrationformsteps::payments\.stripe_payment'\)/", $content, $matches); if (count($matches) > 0) { $code = $matches[0]; $snippet = " @if (isModuleActive('RegistrationFormSteps')) @include('registrationagreement::components.agreement_checkbox') @endif @include('registrationformsteps::payments.stripe_payment') "; $code = $snippet; $content = preg_replace("/@include\('registrationformsteps::payments\.stripe_payment'\)/", $code, $content); $update = true; } } if ($update) { file_put_contents($path, $content); } } } } }