Skip to content

Instantly share code, notes, and snippets.

@primeinc
Created January 20, 2023 15:21
Show Gist options
  • Save primeinc/2054ac2a43923a7f3db3140cd728bcb8 to your computer and use it in GitHub Desktop.
Save primeinc/2054ac2a43923a7f3db3140cd728bcb8 to your computer and use it in GitHub Desktop.
test
if (Storage::disk('local')->exists($sqlFilePath)) {
try {
$fileContent = Storage::disk('local')->get($sqlFilePath);
} catch (\Exception $e) {
dd('Whoops: ' . $e->getMessage());
}
if(!$fileContent) {
throw new \Exception("SQL File is empty: {$sqlFilePath}");
}
$updatedContent = preg_replace('/CREATE TABLE.*;/s', '', $fileContent);
Storage::disk('local')->put($sqlFilePath, $updatedContent);
} else {
throw new \Exception("SQL File not found: {$sqlFilePath}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment