| Conditions | 5 |
| Paths | 4 |
| Total Lines | 32 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | public function handle(array $parameters) |
||
| 18 | { |
||
| 19 | $parameters = $this->commandParameters($parameters); |
||
| 20 | |||
| 21 | if (strtolower($parameters['name']) === 'mailable') { |
||
| 22 | |||
| 23 | return [ |
||
| 24 | 'status' => 'error', |
||
| 25 | 'message' => 'You cannot use this name', |
||
| 26 | ]; |
||
| 27 | } |
||
| 28 | |||
| 29 | if (! MailEclipse::getMailable('name', $parameters['name'])->isEmpty() && !isset($parameters['force'])) { |
||
| 30 | |||
| 31 | return [ |
||
| 32 | 'status' => 'error', |
||
| 33 | 'message' => 'This mailable name already exists. names should be unique! to override it, enable "force" option.', |
||
| 34 | ]; |
||
| 35 | } |
||
| 36 | |||
| 37 | $exitCode = Artisan::call('make:mail', $parameters); |
||
| 38 | |||
| 39 | if ($exitCode > -1) { |
||
| 40 | return [ |
||
| 41 | 'status' => 'ok', |
||
| 42 | 'message' => 'Mailable Created<br> <small>Reloading...<small>', |
||
| 43 | ]; |
||
| 44 | } |
||
| 45 | |||
| 46 | return [ |
||
| 47 | 'status' => 'error', |
||
| 48 | 'message' => 'Unable to create the Mailable, please double check the log file', |
||
| 49 | ]; |
||
| 69 |