@@ -168,7 +168,7 @@ |
||
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
| 171 | - * @return mixed |
|
| 171 | + * @return integer |
|
| 172 | 172 | */ |
| 173 | 173 | private function findHighestIncrement($list) |
| 174 | 174 | { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function allOnlineInLang($lang) |
| 59 | 59 | { |
| 60 | - return $this->model->whereHas('translations', function (Builder $q) use ($lang) { |
|
| 60 | + return $this->model->whereHas('translations', function(Builder $q) use ($lang) { |
|
| 61 | 61 | $q->where('locale', "$lang"); |
| 62 | 62 | $q->where('online', true); |
| 63 | 63 | })->with('translations')->orderBy('created_at', 'DESC')->get(); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $lang = $this->getCurrentLocale(); |
| 74 | 74 | |
| 75 | - $block = $this->model->whereHas('translations', function (Builder $q) use ($lang) { |
|
| 75 | + $block = $this->model->whereHas('translations', function(Builder $q) use ($lang) { |
|
| 76 | 76 | $q->where('locale', "$lang"); |
| 77 | 77 | $q->where('online', true); |
| 78 | 78 | })->with('translations')->whereName($name)->first(); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | private function sluggify(array &$data) |
| 97 | 97 | { |
| 98 | - $data['name'] = $this->makeNameUnique($data['name']); |
|
| 98 | + $data[ 'name' ] = $this->makeNameUnique($data[ 'name' ]); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -111,20 +111,20 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | if ( |
| 113 | 113 | $this->isEmptyArray($list) || |
| 114 | - ! $this->isSlugInList($slug, $list) || |
|
| 114 | + !$this->isSlugInList($slug, $list) || |
|
| 115 | 115 | ($this->isForModel($list) && $this->slugIsInList($slug, $list)) |
| 116 | 116 | ) { |
| 117 | 117 | return $slug; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // map our list to keep only the increments |
| 121 | - $len = strlen($slug . '-'); |
|
| 121 | + $len = strlen($slug.'-'); |
|
| 122 | 122 | |
| 123 | - array_walk($list, function (&$value, $key) use ($len) { |
|
| 123 | + array_walk($list, function(&$value, $key) use ($len) { |
|
| 124 | 124 | $value = intval(substr($value, $len)); |
| 125 | 125 | }); |
| 126 | 126 | |
| 127 | - return $slug . '-' . $this->findHighestIncrement($list); |
|
| 127 | + return $slug.'-'.$this->findHighestIncrement($list); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | private function getExistingSlugs($slug) |
| 136 | 136 | { |
| 137 | - $query = $this->model->where('name', 'LIKE', $slug . '%'); |
|
| 137 | + $query = $this->model->where('name', 'LIKE', $slug.'%'); |
|
| 138 | 138 | |
| 139 | 139 | $list = $query->pluck('name', $this->model->getKeyName())->toArray(); |
| 140 | 140 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | private function slugIsInList($slug, array $list) |
| 182 | 182 | { |
| 183 | - return $list[$this->model->getKey()] === $slug; |
|
| 183 | + return $list[ $this->model->getKey() ] === $slug; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -11,14 +11,14 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | public function up() |
| 13 | 13 | { |
| 14 | - Schema::create('block__blocks', function (Blueprint $table) { |
|
| 14 | + Schema::create('block__blocks', function(Blueprint $table) { |
|
| 15 | 15 | $table->engine = 'InnoDB'; |
| 16 | 16 | $table->increments('id'); |
| 17 | 17 | $table->string('name'); |
| 18 | 18 | $table->timestamps(); |
| 19 | 19 | }); |
| 20 | 20 | |
| 21 | - Schema::create('block__blocks_translations', function (Blueprint $table) { |
|
| 21 | + Schema::create('block__blocks_translations', function(Blueprint $table) { |
|
| 22 | 22 | $table->engine = 'InnoDB'; |
| 23 | 23 | $table->increments('id'); |
| 24 | 24 | $table->tinyInteger('online')->nullable(); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | $table->integer('block_id')->unsigned(); |
| 28 | 28 | $table->string('locale')->index(); |
| 29 | - $table->unique(['block_id', 'locale']); |
|
| 29 | + $table->unique([ 'block_id', 'locale' ]); |
|
| 30 | 30 | $table->foreign('block_id')->references('id')->on('block__blocks')->onDelete('cascade'); |
| 31 | 31 | }); |
| 32 | 32 | } |
@@ -32,6 +32,6 @@ |
||
| 32 | 32 | |
| 33 | 33 | public function messages() |
| 34 | 34 | { |
| 35 | - return []; |
|
| 35 | + return [ ]; |
|
| 36 | 36 | } |
| 37 | 37 | } |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | @include('block::admin.blocks.partials.create-fields', ['lang' => $locale, '']) |
| 30 | 30 | </div> |
| 31 | 31 | <?php endforeach; ?> |
| 32 | - <?php if (config('asgard.block.config.partials.normal.create') !== []): ?> |
|
| 32 | + <?php if (config('asgard.block.config.partials.normal.create') !== [ ]): ?> |
|
| 33 | 33 | <?php foreach (config('asgard.block.config.partials.normal.create') as $partial): ?> |
| 34 | 34 | @include($partial) |
| 35 | 35 | <?php endforeach; ?> |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | |
| 4 | 4 | {!! Form::i18nCheckbox('online', trans('block::blocks.online'), $errors, $lang) !!} |
| 5 | 5 | |
| 6 | - <?php if (config('asgard.block.config.partials.translatable.create') !== []): ?> |
|
| 6 | + <?php if (config('asgard.block.config.partials.translatable.create') !== [ ]): ?> |
|
| 7 | 7 | <?php foreach (config('asgard.block.config.partials.translatable.create') as $partial): ?> |
| 8 | 8 | @include($partial) |
| 9 | 9 | <?php endforeach; ?> |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | |
| 4 | 4 | {!! Form::i18nCheckbox('online', trans('block::blocks.online'), $errors, $lang, $block) !!} |
| 5 | 5 | |
| 6 | - <?php if (config('asgard.block.config.partials.translatable.edit') !== []): ?> |
|
| 6 | + <?php if (config('asgard.block.config.partials.translatable.edit') !== [ ]): ?> |
|
| 7 | 7 | <?php foreach (config('asgard.block.config.partials.translatable.edit') as $partial): ?> |
| 8 | 8 | @include($partial) |
| 9 | 9 | <?php endforeach; ?> |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | @include('block::admin.blocks.partials.edit-fields', ['lang' => $locale]) |
| 30 | 30 | </div> |
| 31 | 31 | <?php endforeach; ?> |
| 32 | - <?php if (config('asgard.block.config.partials.normal.edit') !== []): ?> |
|
| 32 | + <?php if (config('asgard.block.config.partials.normal.edit') !== [ ]): ?> |
|
| 33 | 33 | <?php foreach (config('asgard.block.config.partials.normal.edit') as $partial): ?> |
| 34 | 34 | @include($partial) |
| 35 | 35 | <?php endforeach; ?> |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | protected $presenter = 'Modules\Block\Presenters\BlockPresenter'; |
| 12 | 12 | protected $table = 'block__blocks'; |
| 13 | - public $translatedAttributes = ['online', 'body']; |
|
| 14 | - protected $fillable = ['name', 'online', 'body']; |
|
| 13 | + public $translatedAttributes = [ 'online', 'body' ]; |
|
| 14 | + protected $fillable = [ 'name', 'online', 'body' ]; |
|
| 15 | 15 | protected $casts = [ |
| 16 | 16 | 'online' => 'bool', |
| 17 | 17 | ]; |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | public function __call($method, $parameters) |
| 20 | 20 | { |
| 21 | 21 | #i: Convert array to dot notation |
| 22 | - $config = implode('.', ['asgard.block.config.relations', $method]); |
|
| 22 | + $config = implode('.', [ 'asgard.block.config.relations', $method ]); |
|
| 23 | 23 | |
| 24 | 24 | #i: Relation method resolver |
| 25 | 25 | if (config()->has($config)) { |
@@ -45,14 +45,14 @@ |
||
| 45 | 45 | |
| 46 | 46 | protected function getEnvironmentSetUp($app) |
| 47 | 47 | { |
| 48 | - $app['path.base'] = __DIR__ . '/..'; |
|
| 49 | - $app['config']->set('database.default', 'sqlite'); |
|
| 50 | - $app['config']->set('database.connections.sqlite', array( |
|
| 48 | + $app[ 'path.base' ] = __DIR__.'/..'; |
|
| 49 | + $app[ 'config' ]->set('database.default', 'sqlite'); |
|
| 50 | + $app[ 'config' ]->set('database.connections.sqlite', array( |
|
| 51 | 51 | 'driver' => 'sqlite', |
| 52 | 52 | 'database' => ':memory:', |
| 53 | 53 | 'prefix' => '', |
| 54 | 54 | )); |
| 55 | - $app['config']->set('translatable.locales', ['en', 'fr']); |
|
| 55 | + $app[ 'config' ]->set('translatable.locales', [ 'en', 'fr' ]); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | private function resetDatabase() |