1 | <?php namespace Modules\Translation\Providers; |
||
17 | class TranslationServiceProvider extends ServiceProvider |
||
18 | { |
||
19 | /** |
||
20 | * Indicates if loading of the provider is deferred. |
||
21 | * |
||
22 | * @var bool |
||
23 | */ |
||
24 | protected $defer = false; |
||
25 | |||
26 | /** |
||
27 | * Register the service provider. |
||
28 | * |
||
29 | * @return void |
||
30 | */ |
||
31 | public function register() |
||
32 | { |
||
33 | $this->registerBindings(); |
||
34 | $this->registerConsoleCommands(); |
||
35 | |||
36 | view()->composer('translation::admin.translations.index', CurrentUserViewComposer::class); |
||
|
|||
37 | } |
||
38 | |||
39 | public function boot() |
||
40 | { |
||
41 | $this->registerValidators(); |
||
42 | |||
43 | if ($this->shouldRegisterCustomTranslator()) { |
||
44 | $this->registerCustomTranslator(); |
||
45 | } |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * Should we register the Custom Translator? |
||
50 | * @return bool |
||
51 | */ |
||
52 | protected function shouldRegisterCustomTranslator() |
||
68 | |||
69 | /** |
||
70 | * Get the services provided by the provider. |
||
71 | * |
||
72 | * @return array |
||
73 | */ |
||
74 | public function provides() |
||
75 | { |
||
76 | return array(); |
||
77 | } |
||
78 | |||
79 | private function registerBindings() |
||
80 | { |
||
81 | $this->app->bind(TranslationRepository::class, function () { |
||
82 | $repository = new EloquentTranslationRepository(new Translation()); |
||
83 | |||
84 | if (! config('app.cache')) { |
||
85 | return $repository; |
||
86 | } |
||
87 | |||
88 | return new CacheTranslationDecorator($repository); |
||
89 | }); |
||
90 | |||
91 | $this->app->bind(FileTranslationRepository::class, function ($app) { |
||
92 | return new FileDiskTranslationRepository($app['files'], $app['translation.loader']); |
||
93 | }); |
||
94 | } |
||
95 | |||
96 | private function registerConsoleCommands() |
||
102 | |||
103 | protected function registerCustomTranslator() |
||
123 | |||
124 | private function registerValidators() |
||
134 | } |
||
135 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: