| Conditions | 3 |
| Paths | 4 |
| Total Lines | 22 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | public function boot() |
||
| 13 | { |
||
| 14 | if ($this->app->runningInConsole()) { |
||
| 15 | $this->commands([ |
||
| 16 | MakeDocument::class, |
||
| 17 | MakeDocumentResource::class, |
||
| 18 | ]); |
||
| 19 | } |
||
| 20 | |||
| 21 | if (! class_exists('CreateDocumentsTable')) { |
||
| 22 | $this->publishes([ |
||
| 23 | __DIR__.'/../database/migrations/create__documents_table.php' => database_path('migrations/'.date('Y_m_d_His', time()).'_create__documents_table.php'), |
||
| 24 | ], 'migrations'); |
||
| 25 | } |
||
| 26 | |||
| 27 | Str::macro('normalize', function ($str) { |
||
| 28 | /** @var \Illuminate\Support\Str $this */ |
||
| 29 | $str = preg_replace('/(?<!^)[A-Z]/', ' $0', $str); |
||
| 30 | $str = Str::slug($str); |
||
| 31 | $str = str_replace('-', ' ', $str); |
||
| 32 | |||
| 33 | return Str::title($str); |
||
| 34 | }); |
||
| 41 |