@@ -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 | } |
@@ -5,6 +5,6 @@ |
||
| 5 | 5 | class BlockTranslation extends Model |
| 6 | 6 | { |
| 7 | 7 | public $timestamps = false; |
| 8 | - protected $fillable = ['online', 'body']; |
|
| 8 | + protected $fillable = [ 'online', 'body' ]; |
|
| 9 | 9 | protected $table = 'block__blocks_translations'; |
| 10 | 10 | } |
@@ -32,6 +32,6 @@ |
||
| 32 | 32 | |
| 33 | 33 | public function messages() |
| 34 | 34 | { |
| 35 | - return []; |
|
| 35 | + return [ ]; |
|
| 36 | 36 | } |
| 37 | 37 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | return $this->cache |
| 23 | 23 | ->tags($this->entityName, 'global') |
| 24 | 24 | ->remember("{$this->locale}.{$this->entityName}.allOnlineInLang", $this->cacheTime, |
| 25 | - function () use ($lang) { |
|
| 25 | + function() use ($lang) { |
|
| 26 | 26 | return $this->repository->allOnlineInLang($lang); |
| 27 | 27 | } |
| 28 | 28 | ); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | return $this->cache |
| 39 | 39 | ->tags($this->entityName, 'global') |
| 40 | 40 | ->remember("{$this->locale}.{$this->entityName}.get", $this->cacheTime, |
| 41 | - function () use ($name) { |
|
| 41 | + function() use ($name) { |
|
| 42 | 42 | return $this->repository->get($name); |
| 43 | 43 | } |
| 44 | 44 | ); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function allOnlineInLang($lang) |
| 43 | 43 | { |
| 44 | - return $this->model->whereHas('translations', function (Builder $q) use ($lang) { |
|
| 44 | + return $this->model->whereHas('translations', function(Builder $q) use ($lang) { |
|
| 45 | 45 | $q->where('locale', "$lang"); |
| 46 | 46 | $q->where('online', true); |
| 47 | 47 | })->with('translations')->orderBy('created_at', 'DESC')->get(); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | $lang = $this->getCurrentLocale(); |
| 58 | 58 | |
| 59 | - $block = $this->model->whereHas('translations', function (Builder $q) use ($lang) { |
|
| 59 | + $block = $this->model->whereHas('translations', function(Builder $q) use ($lang) { |
|
| 60 | 60 | $q->where('locale', "$lang"); |
| 61 | 61 | $q->where('online', true); |
| 62 | 62 | })->with('translations')->whereName($name)->first(); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | private function sluggify(array &$data) |
| 81 | 81 | { |
| 82 | - $data['name'] = $this->makeNameUnique($data['name']); |
|
| 82 | + $data[ 'name' ] = $this->makeNameUnique($data[ 'name' ]); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | if ( |
| 97 | 97 | $this->isEmptyArray($list) || |
| 98 | - ! $this->isSlugInList($slug, $list) || |
|
| 98 | + !$this->isSlugInList($slug, $list) || |
|
| 99 | 99 | ($this->isForModel($list) && $this->slugIsInList($slug, $list)) |
| 100 | 100 | ) { |
| 101 | 101 | return $slug; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | // map our list to keep only the increments |
| 105 | 105 | $len = strlen($slug . '-'); |
| 106 | 106 | |
| 107 | - array_walk($list, function (&$value, $key) use ($len) { |
|
| 107 | + array_walk($list, function(&$value, $key) use ($len) { |
|
| 108 | 108 | $value = intval(substr($value, $len)); |
| 109 | 109 | }); |
| 110 | 110 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | private function slugIsInList($slug, array $list) |
| 166 | 166 | { |
| 167 | - return $list[$this->model->getKey()] === $slug; |
|
| 167 | + return $list[ $this->model->getKey() ] === $slug; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -29,8 +29,8 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | public function extendWith(Menu $menu) |
| 31 | 31 | { |
| 32 | - $menu->group(trans('core::sidebar.content'), function (Group $group) { |
|
| 33 | - $group->item(trans('block::blocks.title.blocks'), function (Item $item) { |
|
| 32 | + $menu->group(trans('core::sidebar.content'), function(Group $group) { |
|
| 33 | + $group->item(trans('block::blocks.title.blocks'), function(Item $item) { |
|
| 34 | 34 | $item->authorize( |
| 35 | 35 | $this->auth->hasAccess('block.blocks.index') |
| 36 | 36 | ); |
@@ -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() |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | /** @test */ |
| 10 | 10 | public function it_creates_blocks() |
| 11 | 11 | { |
| 12 | - $block = $this->block->create(['name' => 'testBlock', 'en' => ['body' => 'lorem en'], 'fr' => ['body' => 'lorem fr']]); |
|
| 12 | + $block = $this->block->create([ 'name' => 'testBlock', 'en' => [ 'body' => 'lorem en' ], 'fr' => [ 'body' => 'lorem fr' ] ]); |
|
| 13 | 13 | $blocks = $this->block->all(); |
| 14 | 14 | |
| 15 | 15 | $this->assertCount(1, $blocks); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** @test */ |
| 39 | 39 | public function it_gets_block_by_name() |
| 40 | 40 | { |
| 41 | - $this->block->create(['name' => 'testblock', 'en' => ['body' => 'lorem en', 'online' => true], 'fr' => ['body' => 'lorem fr', 'online' => true]]); |
|
| 41 | + $this->block->create([ 'name' => 'testblock', 'en' => [ 'body' => 'lorem en', 'online' => true ], 'fr' => [ 'body' => 'lorem fr', 'online' => true ] ]); |
|
| 42 | 42 | $this->createRandomBlock(true, true); |
| 43 | 43 | $this->createRandomBlock(true, true); |
| 44 | 44 | $this->createRandomBlock(true, true); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | /** @test */ |
| 52 | 52 | public function it_gets_block_by_name_if_online() |
| 53 | 53 | { |
| 54 | - $this->block->create(['name' => 'testBlock', 'en' => ['body' => 'lorem en', 'online' => true], 'fr' => ['body' => 'lorem fr', 'online' => false]]); |
|
| 54 | + $this->block->create([ 'name' => 'testBlock', 'en' => [ 'body' => 'lorem en', 'online' => true ], 'fr' => [ 'body' => 'lorem fr', 'online' => false ] ]); |
|
| 55 | 55 | $this->createRandomBlock(true, true); |
| 56 | 56 | $this->createRandomBlock(true, true); |
| 57 | 57 | $this->createRandomBlock(true, true); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | /** @test */ |
| 69 | 69 | public function it_gets_block_by_facade() |
| 70 | 70 | { |
| 71 | - $this->block->create(['name' => 'testblock', 'en' => ['body' => 'lorem en', 'online' => true], 'fr' => ['body' => 'lorem fr', 'online' => false]]); |
|
| 71 | + $this->block->create([ 'name' => 'testblock', 'en' => [ 'body' => 'lorem en', 'online' => true ], 'fr' => [ 'body' => 'lorem fr', 'online' => false ] ]); |
|
| 72 | 72 | $this->createRandomBlock(true, true); |
| 73 | 73 | $this->createRandomBlock(true, true); |
| 74 | 74 | |
@@ -80,15 +80,15 @@ discard block |
||
| 80 | 80 | /** @test */ |
| 81 | 81 | public function it_slugifies_the_name_property() |
| 82 | 82 | { |
| 83 | - $block = $this->block->create(['name' => 'test block', 'en' => ['body' => 'lorem en', 'online' => true], 'fr' => ['body' => 'lorem fr', 'online' => false]]); |
|
| 83 | + $block = $this->block->create([ 'name' => 'test block', 'en' => [ 'body' => 'lorem en', 'online' => true ], 'fr' => [ 'body' => 'lorem fr', 'online' => false ] ]); |
|
| 84 | 84 | |
| 85 | 85 | $this->assertEquals('test-block', $block->name); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | public function it_makes_name_unique() |
| 89 | 89 | { |
| 90 | - $this->block->create(['name' => 'test block']); |
|
| 91 | - $block = $this->block->create(['name' => 'test block']); |
|
| 90 | + $this->block->create([ 'name' => 'test block' ]); |
|
| 91 | + $block = $this->block->create([ 'name' => 'test block' ]); |
|
| 92 | 92 | |
| 93 | 93 | $this->assertEquals('test-block-1', $block->name); |
| 94 | 94 | } |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | /** @test */ |
| 97 | 97 | public function it_increments_name_if_not_unique() |
| 98 | 98 | { |
| 99 | - $this->block->create(['name' => 'test block']); |
|
| 100 | - $this->block->create(['name' => 'test block']); |
|
| 101 | - $block1 = $this->block->create(['name' => 'test block']); |
|
| 102 | - $block2 = $this->block->create(['name' => 'test block']); |
|
| 99 | + $this->block->create([ 'name' => 'test block' ]); |
|
| 100 | + $this->block->create([ 'name' => 'test block' ]); |
|
| 101 | + $block1 = $this->block->create([ 'name' => 'test block' ]); |
|
| 102 | + $block2 = $this->block->create([ 'name' => 'test block' ]); |
|
| 103 | 103 | |
| 104 | 104 | $this->assertEquals('test-block-2', $block1->name); |
| 105 | 105 | $this->assertEquals('test-block-3', $block2->name); |
@@ -108,8 +108,8 @@ discard block |
||
| 108 | 108 | /** @test */ |
| 109 | 109 | public function it_updates_block_without_name_change() |
| 110 | 110 | { |
| 111 | - $block = $this->block->create(['name' => 'test block']); |
|
| 112 | - $this->block->update($block, ['name' => 'test-block']); |
|
| 111 | + $block = $this->block->create([ 'name' => 'test block' ]); |
|
| 112 | + $this->block->update($block, [ 'name' => 'test-block' ]); |
|
| 113 | 113 | |
| 114 | 114 | $this->assertEquals($block->name, 'test-block'); |
| 115 | 115 | } |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | /** @test */ |
| 118 | 118 | public function it_updates_block_with_name_change() |
| 119 | 119 | { |
| 120 | - $block = $this->block->create(['name' => 'test block']); |
|
| 121 | - $this->block->update($block, ['name' => 'my awesome block']); |
|
| 120 | + $block = $this->block->create([ 'name' => 'test block' ]); |
|
| 121 | + $this->block->update($block, [ 'name' => 'my awesome block' ]); |
|
| 122 | 122 | |
| 123 | 123 | $this->assertEquals($block->name, 'my-awesome-block'); |
| 124 | 124 | } |
@@ -32,6 +32,6 @@ |
||
| 32 | 32 | |
| 33 | 33 | public function messages() |
| 34 | 34 | { |
| 35 | - return []; |
|
| 35 | + return [ ]; |
|
| 36 | 36 | } |
| 37 | 37 | } |