From cf1cbd334e656f26eaf1c1bce5894a76d98c0466 Mon Sep 17 00:00:00 2001 From: oliverbj Date: Tue, 24 Jan 2023 14:42:25 +0100 Subject: [PATCH] wip --- src/CordServiceProvider.php | 34 ++++++++++++++-------------------- src/Facades/Cord.php | 3 ++- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/CordServiceProvider.php b/src/CordServiceProvider.php index 012af2f..f0400c4 100644 --- a/src/CordServiceProvider.php +++ b/src/CordServiceProvider.php @@ -2,31 +2,25 @@ namespace Oliverbj\Cord; -use Oliverbj\Cord\Commands\CordCommand; -use Spatie\LaravelPackageTools\Package; -use Spatie\LaravelPackageTools\PackageServiceProvider; +use Illuminate\Support\ServiceProvider; -class CordServiceProvider extends PackageServiceProvider +class CordServiceProvider extends ServiceProvider { - public function configurePackage(Package $package): void - { - /* - * This class is a Package Service Provider - * - * More info: https://github.com/spatie/laravel-package-tools - */ - $package - ->name('cord') - ->hasConfigFile() - ->hasViews() - ->hasMigration('create_cord_table') - ->hasCommand(CordCommand::class); - } - public function register() { - $this->app->singleton('cord', function () { + $this->app->bind('cord', function ($app) { return new Cord(); }); + + $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'cord'); + } + + public function boot() + { + if ($this->app->runningInConsole()) { + $this->publishes([ + __DIR__.'/../config/config.php' => config_path('cord.php'), + ], 'config'); + } } } diff --git a/src/Facades/Cord.php b/src/Facades/Cord.php index f0ec3b9..f12031a 100644 --- a/src/Facades/Cord.php +++ b/src/Facades/Cord.php @@ -11,6 +11,7 @@ class Cord extends Facade { protected static function getFacadeAccessor() { - return \Oliverbj\Cord\Cord::class; + //return \Oliverbj\Cord\Cord::class; + return 'cord'; } }