2
2
/**
3
3
* This file is part of laravel-stubs package.
4
4
*
5
+ * @author ATehnix <[email protected] >
5
6
* @author Daniel Camargo <[email protected] >
6
7
*
7
8
* For the full copyright and license information, please view the LICENSE
8
9
* file that was distributed with this source code.
9
10
*/
10
11
11
- namespace ATehnix \LaravelStubs \Console ;
12
+ namespace ATehnix \LaravelStubs \Database ;
12
13
13
14
use Illuminate \Database \Migrations \MigrationCreator as BaseMigrationCreator ;
14
15
@@ -25,62 +26,13 @@ class MigrationCreator extends BaseMigrationCreator
25
26
protected function getStub ($ table , $ create )
26
27
{
27
28
if (is_null ($ table )) {
28
- return $ this ->getBlankStub ($ table , $ create );
29
- }
30
- return ($ create ) ? $ this ->getCreateStub ($ table , $ create ) : $ this ->getUpdateStub ($ table , $ create );
31
- }
32
-
33
- /**
34
- * Get blank stub
35
- *
36
- * @param $table
37
- * @param $create
38
- * @return string
39
- * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
40
- */
41
- private function getBlankStub ($ table , $ create )
42
- {
43
- $ blankStub = config ('stubs.path ' ) . '/migration.blank.stub ' ;
44
- if (!file_exists ($ blankStub )) {
45
- return parent ::getStub ($ table , $ create );
46
- }
47
-
48
- return $ this ->files ->get ($ blankStub );
49
- }
50
-
51
- /**
52
- * Get create stub
53
- *
54
- * @param $table
55
- * @param $create
56
- * @return string
57
- * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
58
- */
59
- private function getCreateStub ($ table , $ create )
60
- {
61
- $ createStub = config ('stubs.path ' ) . '/migration.create.stub ' ;
62
- if (!file_exists ($ createStub )) {
63
- return parent ::getStub ($ table , $ create );
64
- }
65
-
66
- return $ this ->files ->get ($ createStub );
67
- }
68
-
69
- /**
70
- * Get update stub
71
- *
72
- * @param $table
73
- * @param $create
74
- * @return string
75
- * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
76
- */
77
- private function getUpdateStub ($ table , $ create )
78
- {
79
- $ updateStub = config ('stubs.path ' ) . '/migration.update.stub ' ;
80
- if (!file_exists ($ updateStub )) {
81
- return parent ::getStub ($ table , $ create );
29
+ $ stub = config ('stubs.path ' ) . '/migration.blank.stub ' ;
30
+ } else {
31
+ $ stub = $ create
32
+ ? config ('stubs.path ' ) . '/migration.create.stub '
33
+ : config ('stubs.path ' ) . '/migration.update.stub ' ;
82
34
}
83
35
84
- return $ this ->files ->get ($ updateStub );
36
+ return file_exists ( $ stub ) ? $ this ->files ->get ($ stub ) : parent :: getStub ( $ table , $ create );
85
37
}
86
38
}
0 commit comments