Conditions | 2 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
29 | public function handle() |
||
30 | { |
||
31 | $name = $this->argument('name'); |
||
32 | $fileName = $name . '.php'; |
||
33 | $filePath = config_path('admin/models/') . $fileName; |
||
34 | |||
35 | if (\File::exists($filePath)) { |
||
36 | $this->error('File ' . $filePath . ' already exists.'); |
||
37 | return; |
||
38 | } |
||
39 | |||
40 | $template = \File::get($this->getStub()); |
||
41 | |||
42 | $render = $this->renderTemplate($template, compact('name')); |
||
43 | |||
44 | // Todo: use the artificers admin path (support path change) |
||
45 | \File::put($filePath, $render); |
||
46 | } |
||
47 | |||
60 |