diff --git a/migrations/2018_03_16_000000_make_settings_value_nullable.php b/migrations/2018_03_16_000000_make_settings_value_nullable.php index 3210ddb3f6..1a779558aa 100644 --- a/migrations/2018_03_16_000000_make_settings_value_nullable.php +++ b/migrations/2018_03_16_000000_make_settings_value_nullable.php @@ -2,8 +2,8 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Schema; class MakeSettingsValueNullable extends Migration { diff --git a/routes/voyager.php b/routes/voyager.php index 82a0757a69..2b806c2aa8 100644 --- a/routes/voyager.php +++ b/routes/voyager.php @@ -43,7 +43,7 @@ Route::get($dataType->slug.'/order', $breadController.'@order')->name($dataType->slug.'.order'); Route::post($dataType->slug.'/action', $breadController.'@action')->name($dataType->slug.'.action'); - Route::post($dataType->slug.'/order', $breadController.'@update_order')->name($dataType->slug.'.update_order');; + Route::post($dataType->slug.'/order', $breadController.'@update_order')->name($dataType->slug.'.update_order'); Route::get($dataType->slug.'/{id}/restore', $breadController.'@restore')->name($dataType->slug.'.restore'); Route::get($dataType->slug.'/relation', $breadController.'@relation')->name($dataType->slug.'.relation'); Route::post($dataType->slug.'/remove', $breadController.'@remove_media')->name($dataType->slug.'.media.remove'); diff --git a/src/Database/Schema/ForeignKey.php b/src/Database/Schema/ForeignKey.php index 4d64d92a9b..97fa6dfd92 100644 --- a/src/Database/Schema/ForeignKey.php +++ b/src/Database/Schema/ForeignKey.php @@ -29,7 +29,11 @@ public static function make(array $foreignKey) } $doctrineForeignKey = new DoctrineForeignKey( - $localColumns, $foreignTable, $foreignColumns, $name, $options + $localColumns, + $foreignTable, + $foreignColumns, + $name, + $options ); if (isset($localTable)) { diff --git a/src/Http/Controllers/ContentTypes/Image.php b/src/Http/Controllers/ContentTypes/Image.php index 1dd98edf5b..8cc80a54b7 100644 --- a/src/Http/Controllers/ContentTypes/Image.php +++ b/src/Http/Controllers/ContentTypes/Image.php @@ -25,8 +25,8 @@ public function handle() $resize_width = null; $resize_height = null; if (isset($this->options->resize) && ( - isset($this->options->resize->width) || isset($this->options->resize->height) - )) { + isset($this->options->resize->width) || isset($this->options->resize->height) + )) { if (isset($this->options->resize->width)) { $resize_width = $this->options->resize->width; } @@ -75,17 +75,17 @@ function (Constraint $constraint) { } $image = InterventionImage::make($file) - ->orientate() + ->orientate() ->resize( - $thumb_resize_width, - $thumb_resize_height, - function (Constraint $constraint) { + $thumb_resize_width, + $thumb_resize_height, + function (Constraint $constraint) { $constraint->aspectRatio(); if (isset($this->options->upsize) && !$this->options->upsize) { $constraint->upsize(); } } - )->encode($file->getClientOriginalExtension(), $resize_quality); + )->encode($file->getClientOriginalExtension(), $resize_quality); } elseif (isset($thumbnails->crop->width) && isset($thumbnails->crop->height)) { $crop_width = $thumbnails->crop->width; $crop_height = $thumbnails->crop->height; diff --git a/src/Http/Controllers/ContentTypes/MultipleImage.php b/src/Http/Controllers/ContentTypes/MultipleImage.php index 100ca647ca..17ff3d545e 100644 --- a/src/Http/Controllers/ContentTypes/MultipleImage.php +++ b/src/Http/Controllers/ContentTypes/MultipleImage.php @@ -32,8 +32,8 @@ public function handle() $resize_height = null; if (isset($this->options->resize) && ( - isset($this->options->resize->width) || isset($this->options->resize->height) - )) { + isset($this->options->resize->width) || isset($this->options->resize->height) + )) { if (isset($this->options->resize->width)) { $resize_width = $this->options->resize->width; } @@ -83,15 +83,15 @@ function (Constraint $constraint) { $image = InterventionImage::make($file) ->orientate() ->resize( - $thumb_resize_width, - $thumb_resize_height, - function (Constraint $constraint) { + $thumb_resize_width, + $thumb_resize_height, + function (Constraint $constraint) { $constraint->aspectRatio(); if (isset($this->options->upsize) && !$this->options->upsize) { $constraint->upsize(); } } - )->encode($file->getClientOriginalExtension(), $resize_quality); + )->encode($file->getClientOriginalExtension(), $resize_quality); } elseif (isset($this->options->thumbnails) && isset($thumbnails->crop->width) && isset($thumbnails->crop->height)) { $crop_width = $thumbnails->crop->width; $crop_height = $thumbnails->crop->height; diff --git a/src/Http/Controllers/VoyagerBreadController.php b/src/Http/Controllers/VoyagerBreadController.php index c82c144c82..9f0aca9fcc 100644 --- a/src/Http/Controllers/VoyagerBreadController.php +++ b/src/Http/Controllers/VoyagerBreadController.php @@ -53,7 +53,8 @@ public function create(Request $request, $table) $dataType = Voyager::model('DataType')->whereName($table)->first(); $data = $this->prepopulateBreadInfo($table); - $data['fieldOptions'] = SchemaManager::describeTable((isset($dataType) && strlen($dataType->model_name) != 0) + $data['fieldOptions'] = SchemaManager::describeTable( + (isset($dataType) && strlen($dataType->model_name) != 0) ? DB::getTablePrefix().app($dataType->model_name)->getTable() : DB::getTablePrefix().$table ); @@ -121,7 +122,8 @@ public function edit($table) $dataType = Voyager::model('DataType')->whereName($table)->first(); - $fieldOptions = SchemaManager::describeTable((strlen($dataType->model_name) != 0) + $fieldOptions = SchemaManager::describeTable( + (strlen($dataType->model_name) != 0) ? DB::getTablePrefix().app($dataType->model_name)->getTable() : DB::getTablePrefix().$dataType->name ); diff --git a/src/Http/Controllers/VoyagerCompassController.php b/src/Http/Controllers/VoyagerCompassController.php index 1e13e04d61..30e5c71ccb 100644 --- a/src/Http/Controllers/VoyagerCompassController.php +++ b/src/Http/Controllers/VoyagerCompassController.php @@ -6,8 +6,6 @@ use Exception; use Illuminate\Http\Request; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; -use Symfony\Component\Process\Exception\ProcessFailedException; -use Symfony\Component\Process\Process; class VoyagerCompassController extends Controller { @@ -71,7 +69,7 @@ public function index(Request $request) $args = (isset($args)) ? ' '.$args : ''; try { - Artisan::call($command . $args); + Artisan::call($command.$args); $artisan_output = Artisan::output(); } catch (Exception $e) { $artisan_output = $e->getMessage(); diff --git a/src/Http/Controllers/VoyagerMediaController.php b/src/Http/Controllers/VoyagerMediaController.php index 25b0421bd8..f3da247742 100644 --- a/src/Http/Controllers/VoyagerMediaController.php +++ b/src/Http/Controllers/VoyagerMediaController.php @@ -274,7 +274,8 @@ public function upload(Request $request) ($thumbnail_data->height ?? null), function ($constraint) { $constraint->aspectRatio(); - }, ($thumbnail_data->position ?? 'center') + }, + ($thumbnail_data->position ?? 'center') ); } elseif ($type == 'crop') { $thumbnail = $thumbnail->crop( diff --git a/src/Models/DataType.php b/src/Models/DataType.php index 5b31a8a4af..fa10cef625 100644 --- a/src/Models/DataType.php +++ b/src/Models/DataType.php @@ -95,7 +95,8 @@ public function updateDataType($requestData, $throw = false) } if ($this->fill($requestData)->save()) { - $fields = $this->fields((strlen($this->model_name) != 0) + $fields = $this->fields( + (strlen($this->model_name) != 0) ? DB::getTablePrefix().app($this->model_name)->getTable() : DB::getTablePrefix().Arr::get($requestData, 'name') ); @@ -213,7 +214,8 @@ public function fieldOptions() // Get ordered BREAD fields $orderedFields = $this->rows()->pluck('field')->toArray(); - $_fieldOptions = SchemaManager::describeTable((strlen($this->model_name) != 0) + $_fieldOptions = SchemaManager::describeTable( + (strlen($this->model_name) != 0) ? app($this->model_name)->getTable() : $this->name )->toArray(); diff --git a/src/Providers/VoyagerDummyServiceProvider.php b/src/Providers/VoyagerDummyServiceProvider.php index e92ac64a08..477165351e 100644 --- a/src/Providers/VoyagerDummyServiceProvider.php +++ b/src/Providers/VoyagerDummyServiceProvider.php @@ -52,7 +52,8 @@ private function registerPublishableResources() public function registerConfigs() { $this->mergeConfigFrom( - dirname(__DIR__).'/../publishable/config/voyager_dummy.php', 'voyager' + dirname(__DIR__).'/../publishable/config/voyager_dummy.php', + 'voyager' ); } } diff --git a/src/Traits/Translatable.php b/src/Traits/Translatable.php index 82ca5ddb6a..27f9dc335d 100644 --- a/src/Traits/Translatable.php +++ b/src/Traits/Translatable.php @@ -278,7 +278,9 @@ public static function scopeWhereTranslation($query, $field, $operator, $value = $self = new static(); $table = $self->getTable(); - return $query->whereIn($self->getKeyName(), Translation::where('table_name', $table) + return $query->whereIn( + $self->getKeyName(), + Translation::where('table_name', $table) ->where('column_name', $field) ->where('value', $operator, $value) ->when(!is_null($locales), function ($query) use ($locales) { diff --git a/src/VoyagerServiceProvider.php b/src/VoyagerServiceProvider.php index 079cd13a92..df1132cda6 100644 --- a/src/VoyagerServiceProvider.php +++ b/src/VoyagerServiceProvider.php @@ -265,7 +265,8 @@ private function registerPublishableResources() public function registerConfigs() { $this->mergeConfigFrom( - dirname(__DIR__).'/publishable/config/voyager.php', 'voyager' + dirname(__DIR__).'/publishable/config/voyager.php', + 'voyager' ); } diff --git a/tests/CompassTest.php b/tests/CompassTest.php index 37cf234dcf..2d28b2f082 100644 --- a/tests/CompassTest.php +++ b/tests/CompassTest.php @@ -55,7 +55,7 @@ public function testCanExecuteCommand() $response = $this->post(route('voyager.compass.index'), [ 'command' => 'make:model', - 'args' => 'TestModel' + 'args' => 'TestModel', ]); $this->assertStringContainsString('Model created successfully.', $response->response->content()); } @@ -66,7 +66,7 @@ public function testCannotExecuteUnknownCommand() $response = $this->post(route('voyager.compass.index'), [ 'command' => 'unknown:command', - 'args' => 'AnArgument' + 'args' => 'AnArgument', ]); $this->assertStringContainsString('The command "unknown:command" does not exist.', $response->response->content()); } diff --git a/tests/DisabledTestException.php b/tests/DisabledTestException.php index 2505026560..113e625e90 100644 --- a/tests/DisabledTestException.php +++ b/tests/DisabledTestException.php @@ -2,7 +2,6 @@ namespace TCG\Voyager\Tests; -use Exception; use Illuminate\Foundation\Exceptions\Handler; class DisabledTestException extends Handler