@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | protected $namespace = 'Modules\Block\Http\Controllers'; |
12 | 12 | |
13 | 13 | /** |
14 | - * @return string |
|
14 | + * @return boolean |
|
15 | 15 | */ |
16 | 16 | protected function getFrontendRoute() |
17 | 17 | { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
30 | - * @return string |
|
30 | + * @return boolean |
|
31 | 31 | */ |
32 | 32 | protected function getApiRoute() |
33 | 33 | { |
@@ -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 | { |
@@ -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 | /** |
@@ -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 | } |
@@ -10,8 +10,8 @@ |
||
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 | ]; |
@@ -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 | } |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$router->bind('block', function ($id) { |
|
3 | +$router->bind('block', function($id) { |
|
4 | 4 | return app(\Modules\Block\Repositories\BlockRepository::class)->find($id); |
5 | 5 | }); |
6 | 6 | |
7 | -$router->group(['prefix' =>'/block'], function () { |
|
8 | - get('blocks', ['as' => 'admin.block.block.index', 'uses' => 'BlockController@index']); |
|
9 | - get('blocks/create', ['as' => 'admin.block.block.create', 'uses' => 'BlockController@create']); |
|
10 | - post('blocks', ['as' => 'admin.block.block.store', 'uses' => 'BlockController@store']); |
|
11 | - get('blocks/{block}/edit', ['as' => 'admin.block.block.edit', 'uses' => 'BlockController@edit']); |
|
12 | - put('blocks/{block}', ['as' => 'admin.block.block.update', 'uses' => 'BlockController@update']); |
|
13 | - delete('blocks/{block}', ['as' => 'admin.block.block.destroy', 'uses' => 'BlockController@destroy']); |
|
7 | +$router->group([ 'prefix' =>'/block' ], function() { |
|
8 | + get('blocks', [ 'as' => 'admin.block.block.index', 'uses' => 'BlockController@index' ]); |
|
9 | + get('blocks/create', [ 'as' => 'admin.block.block.create', 'uses' => 'BlockController@create' ]); |
|
10 | + post('blocks', [ 'as' => 'admin.block.block.store', 'uses' => 'BlockController@store' ]); |
|
11 | + get('blocks/{block}/edit', [ 'as' => 'admin.block.block.edit', 'uses' => 'BlockController@edit' ]); |
|
12 | + put('blocks/{block}', [ 'as' => 'admin.block.block.update', 'uses' => 'BlockController@update' ]); |
|
13 | + delete('blocks/{block}', [ 'as' => 'admin.block.block.destroy', 'uses' => 'BlockController@destroy' ]); |
|
14 | 14 | }); |
@@ -37,10 +37,10 @@ |
||
37 | 37 | { |
38 | 38 | $this->app->bind( |
39 | 39 | 'Modules\Block\Repositories\BlockRepository', |
40 | - function () { |
|
40 | + function() { |
|
41 | 41 | $repository = new EloquentBlockRepository(new Block()); |
42 | 42 | |
43 | - if (! config('app.cache')) { |
|
43 | + if (!config('app.cache')) { |
|
44 | 44 | return $repository; |
45 | 45 | } |
46 | 46 |
@@ -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 | ); |