1 | <?php |
||
10 | class TranslateTableCommand extends BaseCommand |
||
11 | { |
||
12 | /** |
||
13 | * The console command signature. |
||
14 | * |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $signature = 'make:translate {name : The name of the translate table.} |
||
18 | {--path= : The location where the migration file should be created.}'; |
||
19 | |||
20 | /** |
||
21 | * The console command description. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $description = 'Create a new translate migration file'; |
||
26 | |||
27 | /** |
||
28 | * The migration creator instance. |
||
29 | * |
||
30 | * @var \Illuminate\Database\Migrations\MigrationCreator |
||
31 | */ |
||
32 | protected $creator; |
||
33 | |||
34 | /** |
||
35 | * The Composer instance. |
||
36 | * |
||
37 | * @var \Illuminate\Support\Composer |
||
38 | */ |
||
39 | protected $composer; |
||
40 | |||
41 | /** |
||
42 | * Create a new migration install command instance. |
||
43 | * |
||
44 | * @param \Dimsav\Translatable\Console\MigrationCreator $creator |
||
45 | * @param \Illuminate\Support\Composer $composer |
||
46 | * @return void |
||
|
|||
47 | */ |
||
48 | public function __construct(MigrationCreator $creator, Composer $composer) |
||
54 | |||
55 | /** |
||
56 | * Execute the console command. |
||
57 | * |
||
58 | * @return void |
||
59 | */ |
||
60 | public function fire() |
||
78 | |||
79 | /** |
||
80 | * Get the translate table name. |
||
81 | * |
||
82 | * @param string $table |
||
83 | * @return string |
||
84 | */ |
||
85 | protected function getTableName($table) |
||
91 | |||
92 | /** |
||
93 | * Get the translate model class name. |
||
94 | * |
||
95 | * @param $table |
||
96 | * @return string |
||
97 | */ |
||
98 | protected function getModelName($table) |
||
110 | |||
111 | /** |
||
112 | * Get the translate migration file name. |
||
113 | * |
||
114 | * @param string $name |
||
115 | * @return string |
||
116 | */ |
||
117 | protected function getMigrationName($name) |
||
121 | |||
122 | /** |
||
123 | * Write the migration file to disk. |
||
124 | * |
||
125 | * @param string $name |
||
126 | * @param string $table |
||
127 | * @param bool $create |
||
128 | * @return string |
||
129 | */ |
||
130 | protected function writeMigration($name, $table, $create) |
||
135 | |||
136 | /** |
||
137 | * Get migration path (either specified by '--path' option or default location). |
||
138 | * |
||
139 | * @return string |
||
140 | */ |
||
141 | protected function getMigrationPath() |
||
149 | } |
||
150 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.