Total Complexity | 2 |
Total Lines | 21 |
Duplicated Lines | 0 % |
Changes | 4 | ||
Bugs | 2 | Features | 0 |
1 | <?php |
||
14 | class TranslatableServiceProvider extends ServiceProvider |
||
15 | { |
||
16 | <<<<<<< Updated upstream |
||
|
|||
17 | public function boot() |
||
18 | { |
||
19 | $this->loadMigrationsFrom(__DIR__.'/database/migrations/'); |
||
20 | |||
21 | $this->publishes([ |
||
22 | __DIR__.'/database/migrations/' => database_path('migrations'), |
||
23 | ], 'migrations'); |
||
24 | |||
25 | $this->publishes([ |
||
26 | __DIR__.'/config/languages.php' => config_path('languages.php'), |
||
27 | ]); |
||
28 | |||
29 | Collection::macro('for', function ($field, $code) { |
||
30 | return $this->where('key', $field)->where('locale', $code)->pluck('value')->first() ?? $field; |
||
31 | }); |
||
32 | } |
||
33 | |||
34 | public function register() |
||
35 | { |
||
60 |