[.\s\S]+?<\/div>/', $content, $matches);
if (count($matches) > 0) {
$code = $matches[0];
$snippet = "
@if (isModuleActive('WTIALaCarte'))
@include('wtialacarte::components.orders_tab_content')
@endif
";
$code = $code.$snippet;
$content = preg_replace('/
[.\s\S]+?<\/div>/', $code, $content);
//file_put_contents($path, $content);
$update = true;
}
}
if ($update) {
file_put_contents($path, $content);
}
}
}
public function addOrdersTabToCustomerDetails()
{
$path = module_path('Customer', 'Resources/views/customers/show_details.blade.php');
if (file_exists($path)) {
$update = false;
$content = file_get_contents($path);
if (!preg_match("/@include\('wtialacarte::components\.customer_orders_tab_content'\)/", $content)) {
$matches = null;
preg_match('/
/', $content, $matches);
if (count($matches) > 0) {
$code = $matches[0];
$snippet = "
@if (isModuleActive('WTIALaCarte'))
@include('wtialacarte::components.customer_orders_tab_content')
@endif
";
$code .= $snippet;
$content = preg_replace('//', $code, $content);
//file_put_contents($path, $content);
$update = true;
}
}
if ($update) {
file_put_contents($path, $content);
}
}
}
public function updateVericyCsrftoken() {
$path = app_path('Http/Middleware/VerifyCsrfToken.php');
if (file_exists($path)) {
$update = false;
$content = file_get_contents($path);
if (!preg_match("/a-la-carte\/webhooks\/stripe/", $content)) {
$matches = null;
preg_match("/\'search\'\,/", $content, $matches);
if (count($matches) > 0) {
$code = $matches[0];
$snippet = "'search',\n\t\t'/a-la-carte/webhooks/stripe',";
$code = $snippet;
$content = preg_replace("/\'search\'\,/", $code, $content);
//file_put_contents($path, $content);
$update = true;
}
if ($update) {
file_put_contents($path, $content);
}
}
}
}
}