6
6
7
7
use Illuminate \Routing \Router ;
8
8
use Illuminate \Support \ServiceProvider ;
9
+ use Rinvex \Support \Traits \ConsoleTools ;
9
10
use Rinvex \Widgets \Factories \WidgetFactory ;
10
11
use Illuminate \View \Compilers \BladeCompiler ;
11
12
use Rinvex \Widgets \Console \Commands \WidgetMakeCommand ;
12
13
13
14
class WidgetsServiceProvider extends ServiceProvider
14
15
{
16
+ use ConsoleTools;
17
+
15
18
/**
16
19
* Register the service provider.
17
20
*
@@ -26,7 +29,7 @@ public function register(): void
26
29
$ this ->registerWidgetCollection ();
27
30
28
31
// Register console commands
29
- ! $ this ->app ->runningInConsole () || $ this ->registerCommands ();
32
+ ! $ this ->app ->runningInConsole () || $ this ->registerWidgetCommands ();
30
33
}
31
34
32
35
/**
@@ -68,7 +71,8 @@ public function boot(Router $router): void
68
71
$ this ->loadViewsFrom (__DIR__ .'/../../resources/views ' , 'rinvex/widgets ' );
69
72
70
73
// Publish Resources
71
- ! $ this ->app ->runningInConsole () || $ this ->publishResources ();
74
+ ! $ this ->app ->runningInConsole () || $ this ->publishesViews ('rinvex/laravel-widgets ' );
75
+ ! $ this ->app ->runningInConsole () || $ this ->publishesConfig ('rinvex/laravel-widgets ' );
72
76
73
77
// Register blade extensions
74
78
$ this ->registerBladeExtensions ();
@@ -100,23 +104,12 @@ protected function loadRoutes(Router $router): void
100
104
}
101
105
}
102
106
103
- /**
104
- * Publish resources.
105
- *
106
- * @return void
107
- */
108
- protected function publishResources (): void
109
- {
110
- $ this ->publishes ([realpath (__DIR__ .'/../../config/config.php ' ) => config_path ('rinvex.widgets.php ' )], 'rinvex-widgets-config ' );
111
- $ this ->publishes ([realpath (__DIR__ .'/../../resources/views ' ) => resource_path ('views/vendor/rinvex/laravel-widgets ' )], 'rinvex-widgets-views ' );
112
- }
113
-
114
107
/**
115
108
* Register console commands.
116
109
*
117
110
* @return void
118
111
*/
119
- protected function registerCommands (): void
112
+ protected function registerWidgetCommands (): void
120
113
{
121
114
// Register artisan commands
122
115
$ this ->app ->singleton ('command.rinvex.widgets.make ' , function ($ app ) {
0 commit comments