Skip to content

Commit 887b4e6

Browse files
committed
Update
1 parent e8e3d8b commit 887b4e6

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/LaravelDbDoc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static function routes()
2121
}
2222

2323
if ($format == 'csv') {
24-
$filename = date('Ymd').self::filename($format);
24+
$filename = date('Ymd').'-'.self::filename($format);
2525

2626
return response($content, 200, [
2727
'Content-Type' => 'text/csv',

src/Presentation/Csv.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function getContents()
3030
$output[] = PHP_EOL;
3131
}
3232

33-
$schema = implode('', $output);
33+
$schema = implode(PHP_EOL, $output);
3434
$stub = $this->getStub();
3535
$database_config = config('database.connections.'.$this->connection);
3636
$host = isset($database_config['host']) ? $database_config['host'] : null;
@@ -46,4 +46,13 @@ public function getContents()
4646
$schema,
4747
], $stub);
4848
}
49+
50+
public function getStub()
51+
{
52+
$path = file_exists(
53+
base_path('stubs/db-doc-csv.stub')
54+
) ? base_path('stubs/db-doc-csv.stub') : __DIR__.'/../../stubs/db-doc-csv.stub';
55+
56+
return file_get_contents($path);
57+
}
4958
}

stubs/db-doc-csv.stub

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
APP_NAME Database Schema
2+
3+
Database Details
4+
5+
Type,Value
6+
Connection,DB_CONNECTION
7+
Host,DB_HOST
8+
Port,DB_PORT
9+
Database,DB_DATABASE
10+
11+
DB_DATABASE Schema
12+
13+
SCHEMA_CONTENT

0 commit comments

Comments
 (0)