@@ -28,7 +28,7 @@ |
||
| 28 | 28 | |
| 29 | 29 | public function onRun() |
| 30 | 30 | { |
| 31 | - $this->page['town'] = $this->loadTown(); |
|
| 31 | + $this->page[ 'town' ] = $this->loadTown(); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | protected function loadTown() |
@@ -59,19 +59,19 @@ |
||
| 59 | 59 | public function onRun() |
| 60 | 60 | { |
| 61 | 61 | // init params |
| 62 | - $this->page['pageParam'] = $this->paramName('pageNumber'); |
|
| 63 | - $this->page['noTownsMessage'] = $this->property('noTownsMessage'); |
|
| 64 | - $this->townPage = $this->page['townPage'] = $this->property('townPage'); |
|
| 62 | + $this->page[ 'pageParam' ] = $this->paramName('pageNumber'); |
|
| 63 | + $this->page[ 'noTownsMessage' ] = $this->property('noTownsMessage'); |
|
| 64 | + $this->townPage = $this->page[ 'townPage' ] = $this->property('townPage'); |
|
| 65 | 65 | |
| 66 | 66 | // load towns |
| 67 | - $this->towns = $this->page['towns'] = $this->listTowns(); |
|
| 67 | + $this->towns = $this->page[ 'towns' ] = $this->listTowns(); |
|
| 68 | 68 | |
| 69 | 69 | // if the page number is not valid, redirect |
| 70 | 70 | if ($pageNumberParam = $this->paramName('pageNumber')) { |
| 71 | 71 | $currentPage = $this->property('pageNumber'); |
| 72 | 72 | |
| 73 | 73 | if ($currentPage > ($lastPage = $this->towns->lastPage()) && $currentPage > 1) { |
| 74 | - return Redirect::to($this->currentPageUrl([$pageNumberParam => $lastPage])); |
|
| 74 | + return Redirect::to($this->currentPageUrl([ $pageNumberParam => $lastPage ])); |
|
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | $table->engine = 'InnoDB'; |
| 16 | 16 | $table->increments('id'); |
| 17 | 17 | |
| 18 | - if ( $this->isPluginActive('RainLab.Location') ) { |
|
| 18 | + if ($this->isPluginActive('RainLab.Location')) { |
|
| 19 | 19 | $table->integer('state_id')->unsigned()->nullable(); |
| 20 | 20 | $table->foreign('state_id')->references('id')->on('rainlab_location_states')->onDelete('set null'); |
| 21 | 21 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function down() |
| 34 | 34 | { |
| 35 | - Schema::table($this->table_name, function ($table) { |
|
| 35 | + Schema::table($this->table_name, function($table) { |
|
| 36 | 36 | $table->dropForeign('vojtasvoboda_locationtown_towns_state_id_foreign'); |
| 37 | 37 | $table->dropIndex('vojtasvoboda_locationtown_towns_state_id_foreign'); |
| 38 | 38 | $table->dropIndex('vojtasvoboda_locationtown_towns_slug_index'); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | 'icon' => 'icon-building-o', |
| 50 | 50 | 'url' => Backend::url('vojtasvoboda/locationtown/towns'), |
| 51 | 51 | 'order' => 500, |
| 52 | - 'permissions' => ['vojtasvoboda.locationtown.*'], |
|
| 52 | + 'permissions' => [ 'vojtasvoboda.locationtown.*' ], |
|
| 53 | 53 | ], |
| 54 | 54 | ]; |
| 55 | 55 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | return [ |
| 64 | 64 | 'functions' => [ |
| 65 | - 'form_select_town' => ['VojtaSvoboda\LocationTown\Models\Town', 'formSelect'], |
|
| 65 | + 'form_select_town' => [ 'VojtaSvoboda\LocationTown\Models\Town', 'formSelect' ], |
|
| 66 | 66 | ] |
| 67 | 67 | ]; |
| 68 | 68 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $this->app->bind('locationtowns', 'VojtaSvoboda\LocationTown\Models\Town'); |
| 73 | 73 | |
| 74 | 74 | State::extend(function($model) { |
| 75 | - $model->hasMany['towns'] = 'VojtaSvoboda\LocationTown\Models\Town'; |
|
| 75 | + $model->hasMany[ 'towns' ] = 'VojtaSvoboda\LocationTown\Models\Town'; |
|
| 76 | 76 | }); |
| 77 | 77 | |
| 78 | 78 | $this->initMenuItems(); |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | $guarded = $model->getGuarded(); |
| 20 | 20 | |
| 21 | - if (count($guarded) === 1 && $guarded[0] === '*') { |
|
| 21 | + if (count($guarded) === 1 && $guarded[ 0 ] === '*') { |
|
| 22 | 22 | $model->addFillable([ |
| 23 | 23 | 'town', |
| 24 | 24 | 'town_id', |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | ]); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - $model->belongsTo['town'] = [\VojtaSvoboda\LocationTown\Models\Town::class]; |
|
| 29 | + $model->belongsTo[ 'town' ] = [ \VojtaSvoboda\LocationTown\Models\Town::class ]; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function getTownOptions() |
@@ -62,6 +62,6 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function setTownIdAttribute($value) |
| 64 | 64 | { |
| 65 | - $this->model->attributes['town_id'] = $value ?: null; |
|
| 65 | + $this->model->attributes[ 'town_id' ] = $value ?: null; |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | \ No newline at end of file |
@@ -20,15 +20,15 @@ discard block |
||
| 20 | 20 | 'is_enabled' => 'boolean' |
| 21 | 21 | ]; |
| 22 | 22 | |
| 23 | - protected $fillable = ['name', 'slug', 'description', 'is_enabled']; |
|
| 23 | + protected $fillable = [ 'name', 'slug', 'description', 'is_enabled' ]; |
|
| 24 | 24 | |
| 25 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 25 | + protected $dates = [ 'created_at', 'updated_at', 'deleted_at' ]; |
|
| 26 | 26 | |
| 27 | 27 | public $belongsTo = [ |
| 28 | 28 | 'state' => 'RainLab\Location\Models\State' |
| 29 | 29 | ]; |
| 30 | 30 | |
| 31 | - public function findOneBySlug($slug, $params = []) |
|
| 31 | + public function findOneBySlug($slug, $params = [ ]) |
|
| 32 | 32 | { |
| 33 | 33 | $params += [ |
| 34 | 34 | 'slug' => $slug |
@@ -61,15 +61,15 @@ discard block |
||
| 61 | 61 | /** |
| 62 | 62 | * @var array Cache for nameList() method |
| 63 | 63 | */ |
| 64 | - protected static $nameList = []; |
|
| 64 | + protected static $nameList = [ ]; |
|
| 65 | 65 | |
| 66 | 66 | public static function getNameList($stateId) |
| 67 | 67 | { |
| 68 | - if (isset(self::$nameList[$stateId])) { |
|
| 69 | - return self::$nameList[$stateId]; |
|
| 68 | + if (isset(self::$nameList[ $stateId ])) { |
|
| 69 | + return self::$nameList[ $stateId ]; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - return self::$nameList[$stateId] = self::whereStateId($stateId)->orderBy('name', 'asc')->lists('name', 'id'); |
|
| 72 | + return self::$nameList[ $stateId ] = self::whereStateId($stateId)->orderBy('name', 'asc')->lists('name', 'id'); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @return string |
| 82 | 82 | */ |
| 83 | - public static function formSelect($name, $stateId = null, $selectedValue = null, $options = []) |
|
| 83 | + public static function formSelect($name, $stateId = null, $selectedValue = null, $options = [ ]) |
|
| 84 | 84 | { |
| 85 | 85 | return Form::select($name, self::getNameList($stateId), $selectedValue, $options); |
| 86 | 86 | } |
@@ -96,15 +96,15 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public static function getMenuTypeInfo($type) |
| 98 | 98 | { |
| 99 | - $result = []; |
|
| 99 | + $result = [ ]; |
|
| 100 | 100 | |
| 101 | 101 | if ($type == 'location-town') { |
| 102 | 102 | |
| 103 | - $references = []; |
|
| 103 | + $references = [ ]; |
|
| 104 | 104 | $towns = self::orderBy('name')->get(); |
| 105 | 105 | foreach ($towns as $town) { |
| 106 | 106 | $town->url = $town->slug; |
| 107 | - $references[$town->id] = $town->name; |
|
| 107 | + $references[ $town->id ] = $town->name; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | $result = [ |
@@ -144,13 +144,13 @@ discard block |
||
| 144 | 144 | $state = $town->state; |
| 145 | 145 | $stateCode = $state->code; |
| 146 | 146 | |
| 147 | - $result = []; |
|
| 148 | - $result['url'] = URL::to('/kontakty/'.$stateCode.'/'.$town->slug); |
|
| 149 | - $result['isActive'] = false; |
|
| 150 | - $result['mtime'] = $town->updated_at; |
|
| 147 | + $result = [ ]; |
|
| 148 | + $result[ 'url' ] = URL::to('/kontakty/'.$stateCode.'/'.$town->slug); |
|
| 149 | + $result[ 'isActive' ] = false; |
|
| 150 | + $result[ 'mtime' ] = $town->updated_at; |
|
| 151 | 151 | } elseif ($item->type == 'all-location-towns') { |
| 152 | 152 | $result = [ |
| 153 | - 'items' => [] |
|
| 153 | + 'items' => [ ] |
|
| 154 | 154 | ]; |
| 155 | 155 | |
| 156 | 156 | $towns = self::orderBy('name')->get(); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | 'isActive' => false, |
| 165 | 165 | ]; |
| 166 | 166 | |
| 167 | - $result['items'][] = $townItem; |
|
| 167 | + $result[ 'items' ][ ] = $townItem; |
|
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |