From 269f6aa7be415d7c8052c66d9e66ebba337cf206 Mon Sep 17 00:00:00 2001 From: Karim Mohamed Date: Sat, 27 Jul 2024 21:45:09 +0300 Subject: [PATCH] Feat: create a facade for the executor pool --- src/Classes/ExecutorPoolClass.php | 25 +++++++++++++++++++++++++ src/ExecutorServiceProvider.php | 14 +++++++++++--- src/Facades/ExecutorPool.php | 13 +++++++++++++ src/Services/ExecutorService.php | 2 +- 4 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 src/Classes/ExecutorPoolClass.php create mode 100644 src/Facades/ExecutorPool.php diff --git a/src/Classes/ExecutorPoolClass.php b/src/Classes/ExecutorPoolClass.php new file mode 100644 index 0000000..034c564 --- /dev/null +++ b/src/Classes/ExecutorPoolClass.php @@ -0,0 +1,25 @@ +paths = [ + base_path('executors'), + ]; + } + + public function getPaths() + { + return $this->paths; + } + + public function addPath($path) + { + array_push($this->paths, $path); + } +} diff --git a/src/ExecutorServiceProvider.php b/src/ExecutorServiceProvider.php index e3d599c..efba8c2 100644 --- a/src/ExecutorServiceProvider.php +++ b/src/ExecutorServiceProvider.php @@ -3,15 +3,25 @@ namespace Pharaonic\Laravel\Executor; use Illuminate\Support\ServiceProvider; +use Pharaonic\Laravel\Executor\Classes\ExecutorPoolClass; use Pharaonic\Laravel\Executor\Console\ExecuteCommand; use Pharaonic\Laravel\Executor\Console\ExecuteFreshCommand; use Pharaonic\Laravel\Executor\Console\ExecuteMakeCommand; use Pharaonic\Laravel\Executor\Console\ExecuteRollbackCommand; use Pharaonic\Laravel\Executor\Console\ExecuteStatusCommand; -use Pharaonic\Laravel\Executor\ExecutorPool; class ExecutorServiceProvider extends ServiceProvider { + /** + * Register services. + * + * @return void + */ + public function register() + { + $this->app->singleton('pharaonic.executor.executorPool', ExecutorPoolClass::class); + } + /** * Bootstrap services. * @@ -19,8 +29,6 @@ class ExecutorServiceProvider extends ServiceProvider */ public function boot() { - ExecutorPool::addPath(base_path('executors')); - if ($this->app->runningInConsole()) { // Publish Migrations $this->publishes( diff --git a/src/Facades/ExecutorPool.php b/src/Facades/ExecutorPool.php new file mode 100644 index 0000000..b5cd587 --- /dev/null +++ b/src/Facades/ExecutorPool.php @@ -0,0 +1,13 @@ +