From b0945b489d230f330f06b30e754312c81743d4df Mon Sep 17 00:00:00 2001 From: Craig Harman Date: Wed, 24 Jul 2019 05:55:32 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/InertiaModel.php | 6 +++-- src/InertiaTableServiceProvider.php | 37 ++++++++++++++++------------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/InertiaModel.php b/src/InertiaModel.php index 91f3b76..2b27953 100644 --- a/src/InertiaModel.php +++ b/src/InertiaModel.php @@ -5,10 +5,12 @@ use Illuminate\Database\Eloquent\Model; use harmonic\InertiaTable\Traits\InertiaTable; -class InertiaModel extends Model { +class InertiaModel extends Model +{ use InertiaTable; - public function resolveRouteBinding($value) { + public function resolveRouteBinding($value) + { return $this->where('id', $value)->withTrashed()->first() ?? abort(404); } } diff --git a/src/InertiaTableServiceProvider.php b/src/InertiaTableServiceProvider.php index e36d477..7807931 100644 --- a/src/InertiaTableServiceProvider.php +++ b/src/InertiaTableServiceProvider.php @@ -5,7 +5,8 @@ use Illuminate\Support\Facades\Route; use Illuminate\Support\ServiceProvider; -class InertiaTableServiceProvider extends ServiceProvider { +class InertiaTableServiceProvider extends ServiceProvider +{ protected $commands = [ 'harmonic\InertiaTable\Commands\MakeInertiaTable', ]; @@ -15,7 +16,8 @@ class InertiaTableServiceProvider extends ServiceProvider { * * @return void */ - public function boot() { + public function boot() + { // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'harmonic'); // $this->loadViewsFrom(__DIR__.'/../resources/views', 'harmonic'); // $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); @@ -24,18 +26,18 @@ public function boot() { // Easily create all the inertia routes Route::macro('inertia', function ($routeName) { $routeName = strtolower($routeName); - $controller = ucfirst($routeName) . 'Controller'; + $controller = ucfirst($routeName).'Controller'; Route::group([ - 'prefix' => '/' . $routeName, + 'prefix' => '/'.$routeName, ], function () use ($controller, $routeName) { - Route::get('/')->name($routeName)->uses($controller . '@index')->middleware('remember'); - Route::get('/create')->name($routeName . '.create')->uses($controller . '@create'); - Route::post('/')->name($routeName . '.store')->uses($controller . '@store'); - Route::get('/' . $routeName . '/edit')->name($routeName . '.edit')->uses($controller . '@edit'); - Route::put('/' . $routeName . '')->name($routeName . '.update')->uses($controller . '@update'); - Route::delete('/' . $routeName . '')->name($routeName . '.destroy')->uses($controller . '@destroy'); - Route::put('/' . $routeName . '/restore')->name($routeName . '.restore')->uses($controller . '@restore'); + Route::get('/')->name($routeName)->uses($controller.'@index')->middleware('remember'); + Route::get('/create')->name($routeName.'.create')->uses($controller.'@create'); + Route::post('/')->name($routeName.'.store')->uses($controller.'@store'); + Route::get('/'.$routeName.'/edit')->name($routeName.'.edit')->uses($controller.'@edit'); + Route::put('/'.$routeName.'')->name($routeName.'.update')->uses($controller.'@update'); + Route::delete('/'.$routeName.'')->name($routeName.'.destroy')->uses($controller.'@destroy'); + Route::put('/'.$routeName.'/restore')->name($routeName.'.restore')->uses($controller.'@restore'); }); }); @@ -50,8 +52,9 @@ public function boot() { * * @return void */ - public function register() { - $this->mergeConfigFrom(__DIR__ . '/../config/inertiatable.php', 'inertiatable'); + public function register() + { + $this->mergeConfigFrom(__DIR__.'/../config/inertiatable.php', 'inertiatable'); $this->commands($this->commands); @@ -66,7 +69,8 @@ public function register() { * * @return array */ - public function provides() { + public function provides() + { return ['inertiatable']; } @@ -75,10 +79,11 @@ public function provides() { * * @return void */ - protected function bootForConsole() { + protected function bootForConsole() + { // Publishing the configuration file. $this->publishes([ - __DIR__ . '/../config/inertiatable.php' => config_path('inertiatable.php'), + __DIR__.'/../config/inertiatable.php' => config_path('inertiatable.php'), ], 'inertiatable.config'); // Publishing the views.