Skip to content

Commit

Permalink
Обновление ThemesServiceProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
Sashagm committed Jul 10, 2023
1 parent 7465493 commit 81f47b2
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 19 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"require": {
"php": "^8.0",
"laravel/framework": "^10.0",
"guzzlehttp/guzzle": "^7.5"
"guzzlehttp/guzzle": "^7.7"
},
"require-dev": {
"phpunit/phpunit": "^10.1"
"phpunit/phpunit": "^10.2"
},
"autoload": {
"psr-4": {
Expand Down
66 changes: 49 additions & 17 deletions src/Providers/ThemesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,68 @@ class ThemesServiceProvider extends ServiceProvider

use BootTrait;


/**
* Register services.
*/
public function register(): void
public function register()
{
//
}

/**
* Bootstrap services.
*/
public function boot(): void
public function boot()
{

$this->registerRouter();

$this->registerView();

$this->registerMigrate();

$this->publishFiles();

$this->bootSys();

$this->registerCommands();

$this->publishSeeds();
}


protected function registerRouter()
{
$this->loadRoutesFrom(__DIR__ . '/../routes/themes.php');
}


protected function registerMigrate()
{
$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
}

protected function registerView()
{
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'themes');
}


protected function publishFiles()
{

$this->loadRoutesFrom(__DIR__.'/../routes/themes.php');
$this->loadViewsFrom(__DIR__.'/../resources/views', 'themes');
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');

$this->publishes([
__DIR__.'/../resources/views' => resource_path('views/vendor/themes'),
__DIR__ . '/../resources/views' => resource_path('views/vendor/themes'),
]);

$this->publishes([
__DIR__.'/../config/themes.php' => config_path('themes.php'),
__DIR__.'/../config/custom.php' => config_path('custom.php'),
__DIR__ . '/../config/themes.php' => config_path('themes.php'),
__DIR__ . '/../config/custom.php' => config_path('custom.php'),
]);
}

$this->bootSys();

protected function registerCommands()
{
if ($this->app->runningInConsole()) {
$this->commands([
ThemesCommand::class,
Expand All @@ -50,14 +84,12 @@ public function boot(): void
GetCommand::class,
]);
}
}

protected function publishSeeds()
{
$this->publishes([
__DIR__ . '/../database/seeds/ThemesSeeder.php' => database_path('seeders/ThemesSeeder.php'),
], 'themes-seeds');





}
}

0 comments on commit 81f47b2

Please sign in to comment.