From 04b8fd5f8aab5d9d7711047c799055b4040403b8 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sun, 6 Mar 2022 14:38:43 +0000 Subject: [PATCH] Apply fixes from StyleCI --- .../Commands/MakeAPIResourceCommand.php | 14 +++++++------ src/Providers/AdmineticServiceProvider.php | 20 +++++++++---------- src/Services/MakeAPIResource.php | 8 +++----- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Console/Commands/MakeAPIResourceCommand.php b/src/Console/Commands/MakeAPIResourceCommand.php index a7586ce..e1d2260 100644 --- a/src/Console/Commands/MakeAPIResourceCommand.php +++ b/src/Console/Commands/MakeAPIResourceCommand.php @@ -43,25 +43,27 @@ public function handle() $path = $this->getModelPath($given_name); if ($this->option('rest')) { MakeAPIResource::makeRestAPI($name, $path); - $this->info('Restful API Resource created for model ' . $name); + $this->info('Restful API Resource created for model '.$name); } elseif ($this->option('client')) { MakeAPIResource::makeClientAPI($name, $path); - $this->info('Client API created for model ' . $name); + $this->info('Client API created for model '.$name); } else { MakeAPIResource::makeAPI($name, $path); - $this->info('API Resource created for model ' . $name); + $this->info('API Resource created for model '.$name); } } public function getModelName($given_name) { - $explode_path = preg_split("#/#", $given_name); + $explode_path = preg_split('#/#', $given_name); + return end($explode_path); } public function getModelPath($given_name) { - $explode_path = preg_split("#/#", $given_name); - return count($explode_path) > 1 ? str_replace('/', '\\', $given_name) : ("App\\Models\\Admin\\" . $given_name); + $explode_path = preg_split('#/#', $given_name); + + return count($explode_path) > 1 ? str_replace('/', '\\', $given_name) : ('App\\Models\\Admin\\'.$given_name); } } diff --git a/src/Providers/AdmineticServiceProvider.php b/src/Providers/AdmineticServiceProvider.php index ccb1fb7..b2d080e 100644 --- a/src/Providers/AdmineticServiceProvider.php +++ b/src/Providers/AdmineticServiceProvider.php @@ -10,10 +10,10 @@ use Illuminate\Support\Facades\Route; use Illuminate\Support\ServiceProvider; use Livewire\Livewire; -use Pratiksh\Adminetic\Console\Commands\MakeAPIResourceCommand; use Pratiksh\Adminetic\Console\Commands\AdmineticDummyCommand; use Pratiksh\Adminetic\Console\Commands\AdmineticResetCommand; use Pratiksh\Adminetic\Console\Commands\InstallAdmineticCommand; +use Pratiksh\Adminetic\Console\Commands\MakeAPIResourceCommand; use Pratiksh\Adminetic\Console\Commands\MakeCRUDGeneratorCommand; use Pratiksh\Adminetic\Console\Commands\MakePermissionCommand; use Pratiksh\Adminetic\Console\Commands\MakeRepositoryPatternCommand; @@ -130,26 +130,26 @@ protected function publishResource() { // Publish Config File $this->publishes([ - __DIR__ . '/../../config/adminetic.php' => config_path('adminetic.php'), + __DIR__.'/../../config/adminetic.php' => config_path('adminetic.php'), ], 'adminetic-config'); // Publish View Files $this->publishes([ - __DIR__ . '/../../resources/views' => resource_path('views/vendor/adminetic'), + __DIR__.'/../../resources/views' => resource_path('views/vendor/adminetic'), ], 'adminetic-views'); // Publish Migration Files $this->publishes([ - __DIR__ . '/../../database/migrations' => database_path('migrations'), + __DIR__.'/../../database/migrations' => database_path('migrations'), ], 'adminetic-migrations'); // Publish Database Seeds $this->publishes([ - __DIR__ . '/../../database/seeders' => database_path('seeders'), + __DIR__.'/../../database/seeders' => database_path('seeders'), ], 'adminetic-seeders'); $this->publishes([ - __DIR__ . '/../../payload/assets' => public_path('adminetic/assets'), + __DIR__.'/../../payload/assets' => public_path('adminetic/assets'), ], 'adminetic-assets-files'); // Publish Static Files $this->publishes([ - __DIR__ . '/../../payload/static' => public_path('adminetic/static'), + __DIR__.'/../../payload/static' => public_path('adminetic/static'), ], 'adminetic-static-files'); } @@ -160,8 +160,8 @@ protected function publishResource() */ protected function registerResource() { - $this->loadMigrationsFrom(__DIR__ . '/../../database/migrations'); // Loading Migration Files - $this->loadViewsFrom(__DIR__ . '/../../resources/views', 'adminetic'); // Loading Views Files + $this->loadMigrationsFrom(__DIR__.'/../../database/migrations'); // Loading Migration Files + $this->loadViewsFrom(__DIR__.'/../../resources/views', 'adminetic'); // Loading Views Files $this->registerRoutes(); } @@ -173,7 +173,7 @@ protected function registerResource() protected function registerRoutes() { Route::group($this->routeConfiguration(), function () { - $this->loadRoutesFrom(__DIR__ . '/../../routes/web.php'); + $this->loadRoutesFrom(__DIR__.'/../../routes/web.php'); }); } diff --git a/src/Services/MakeAPIResource.php b/src/Services/MakeAPIResource.php index 1317c6c..0981c7e 100644 --- a/src/Services/MakeAPIResource.php +++ b/src/Services/MakeAPIResource.php @@ -2,7 +2,6 @@ namespace Pratiksh\Adminetic\Services; -use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Str; use Pratiksh\Adminetic\Services\Helper\CommandHelper; @@ -34,7 +33,7 @@ public static function makeAPI($name, $path) */ protected static function makeRestAPIController($name, $path) { - if (!file_exists($dir_path = app_path('Http/Controllers/Admin/API/Restful'))) { + if (! file_exists($dir_path = app_path('Http/Controllers/Admin/API/Restful'))) { mkdir($dir_path, 0777, true); } @@ -56,7 +55,6 @@ protected static function makeRestAPIController($name, $path) file_put_contents(app_path("/Http/Controllers/Admin/API/Restful/{$name}RestAPIController.php"), $controllerTemplate); } - /** * Make Client API Resource. */ @@ -65,7 +63,7 @@ protected static function makeClientAPIResource($name, $path) // Making API Resource self::makeAPIResource($name, $path); // Making Controller - if (!file_exists($dir_path = app_path('Http/Controllers/Admin/API/Client'))) { + if (! file_exists($dir_path = app_path('Http/Controllers/Admin/API/Client'))) { mkdir($dir_path, 0777, true); } $controllerTemplate = str_replace( @@ -88,7 +86,7 @@ protected static function makeClientAPIResource($name, $path) protected static function makeAPIResource($name, $path) { - if (!file_exists($dir_path = app_path("/Http/Resources/{$name}"))) { + if (! file_exists($dir_path = app_path("/Http/Resources/{$name}"))) { mkdir($dir_path, 0777, true); } // Making Collection