Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

提升默认值初始化步骤到构造函数 #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "laravel-admin-ext/china-distpicker",
"name": "tudouer/china-distpicker",
"description": "Distpicker extension for laravel-admin",
"type": "library",
"keywords": ["laravel-admin", "extension", "distpicker"],
Expand Down
4 changes: 2 additions & 2 deletions src/Distpicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public function __construct($column, $arguments)
}

$this->label = empty($arguments) ? '地区选择' : current($arguments);

$this->attribute('data-value-type', 'code');
}

public function getValidator(array $input)
Expand Down Expand Up @@ -85,8 +87,6 @@ public function autoselect($count = 0)
*/
public function render()
{
$this->attribute('data-value-type', 'code');

$province = old($this->column['province'], Arr::get($this->value(), 'province')) ?: Arr::get($this->placeholder, 'province');
$city = old($this->column['city'], Arr::get($this->value(), 'city')) ?: Arr::get($this->placeholder, 'city');
$district = old($this->column['district'], Arr::get($this->value(), 'district')) ?: Arr::get($this->placeholder, 'district');
Expand Down