itstructure /
laravel-grid-view
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | namespace Itstructure\GridView; |
||||||
| 4 | |||||||
| 5 | use Illuminate\Support\Facades\Blade; |
||||||
| 6 | use Illuminate\Support\ServiceProvider; |
||||||
| 7 | use Itstructure\GridView\Commands\PublishCommand; |
||||||
| 8 | |||||||
| 9 | /** |
||||||
| 10 | * Class GridViewServiceProvider |
||||||
| 11 | * @package Itstructure\GridView |
||||||
| 12 | */ |
||||||
| 13 | class GridViewServiceProvider extends ServiceProvider |
||||||
| 14 | { |
||||||
| 15 | public function register() |
||||||
| 16 | { |
||||||
| 17 | $this->registerCommands(); |
||||||
| 18 | } |
||||||
| 19 | |||||||
| 20 | public function boot() |
||||||
| 21 | { |
||||||
| 22 | // Loading settings |
||||||
| 23 | $this->loadViews(); |
||||||
| 24 | $this->loadTranslations(); |
||||||
| 25 | |||||||
| 26 | // Publish settings |
||||||
| 27 | $this->publishViews(); |
||||||
| 28 | $this->publishTranslations(); |
||||||
| 29 | |||||||
| 30 | // Directives |
||||||
| 31 | require_once __DIR__ . '/functions.php'; |
||||||
| 32 | |||||||
| 33 | Blade::directive('gridView', function ($config) { |
||||||
| 34 | return "<?php echo grid_view($config); ?>"; |
||||||
| 35 | }); |
||||||
| 36 | } |
||||||
| 37 | |||||||
| 38 | |||||||
| 39 | /* |
||||||
| 40 | |-------------------------------------------------------------------------- |
||||||
| 41 | | COMMAND SETTINGS |
||||||
| 42 | |-------------------------------------------------------------------------- |
||||||
| 43 | */ |
||||||
| 44 | |||||||
| 45 | /** |
||||||
| 46 | * Register commands. |
||||||
| 47 | * @return void |
||||||
| 48 | */ |
||||||
| 49 | private function registerCommands(): void |
||||||
| 50 | { |
||||||
| 51 | $this->commands(PublishCommand::class); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 52 | } |
||||||
| 53 | |||||||
| 54 | |||||||
| 55 | /* |
||||||
| 56 | |-------------------------------------------------------------------------- |
||||||
| 57 | | LOADING SETTINGS |
||||||
| 58 | |-------------------------------------------------------------------------- |
||||||
| 59 | */ |
||||||
| 60 | |||||||
| 61 | /** |
||||||
| 62 | * Set directory to load views. |
||||||
| 63 | * @return void |
||||||
| 64 | */ |
||||||
| 65 | private function loadViews(): void |
||||||
| 66 | { |
||||||
| 67 | $this->loadViewsFrom($this->packagePath('resources/views'), 'grid_view'); |
||||||
|
0 ignored issues
–
show
The method
loadViewsFrom() does not exist on Itstructure\GridView\GridViewServiceProvider. Did you maybe mean loadViews()?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||||
| 68 | } |
||||||
| 69 | |||||||
| 70 | /** |
||||||
| 71 | * Set directory to load translations. |
||||||
| 72 | * @return void |
||||||
| 73 | */ |
||||||
| 74 | private function loadTranslations(): void |
||||||
| 75 | { |
||||||
| 76 | $this->loadTranslationsFrom($this->packagePath('resources/lang'), 'grid_view'); |
||||||
|
0 ignored issues
–
show
The method
loadTranslationsFrom() does not exist on Itstructure\GridView\GridViewServiceProvider. Did you maybe mean loadTranslations()?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||||
| 77 | } |
||||||
| 78 | |||||||
| 79 | |||||||
| 80 | /* |
||||||
| 81 | |-------------------------------------------------------------------------- |
||||||
| 82 | | PUBLISH SETTINGS |
||||||
| 83 | |-------------------------------------------------------------------------- |
||||||
| 84 | */ |
||||||
| 85 | |||||||
| 86 | /** |
||||||
| 87 | * Publish views. |
||||||
| 88 | * @return void |
||||||
| 89 | */ |
||||||
| 90 | private function publishViews(): void |
||||||
| 91 | { |
||||||
| 92 | $this->publishes([ |
||||||
|
0 ignored issues
–
show
The method
publishes() does not exist on Itstructure\GridView\GridViewServiceProvider. Did you maybe mean publishViews()?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||||
| 93 | $this->packagePath('resources/views') => resource_path('views/vendor/grid_view'), |
||||||
| 94 | ], 'views'); |
||||||
| 95 | } |
||||||
| 96 | |||||||
| 97 | /** |
||||||
| 98 | * Publish translations. |
||||||
| 99 | * @return void |
||||||
| 100 | */ |
||||||
| 101 | private function publishTranslations(): void |
||||||
| 102 | { |
||||||
| 103 | $this->publishes([ |
||||||
| 104 | $this->packagePath('resources/lang') => resource_path('lang/vendor/grid_view'), |
||||||
| 105 | ], 'lang'); |
||||||
| 106 | } |
||||||
| 107 | |||||||
| 108 | |||||||
| 109 | /* |
||||||
| 110 | |-------------------------------------------------------------------------- |
||||||
| 111 | | OTHER SETTINGS |
||||||
| 112 | |-------------------------------------------------------------------------- |
||||||
| 113 | */ |
||||||
| 114 | |||||||
| 115 | /** |
||||||
| 116 | * @param $path |
||||||
| 117 | * @return string |
||||||
| 118 | */ |
||||||
| 119 | private function packagePath($path): string |
||||||
| 120 | { |
||||||
| 121 | return __DIR__ . "/../" . $path; |
||||||
| 122 | } |
||||||
| 123 | } |
||||||
| 124 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.