Skip to content

Commit

Permalink
builder
Browse files Browse the repository at this point in the history
  • Loading branch information
funadmin committed Oct 19, 2023
1 parent e1c2e56 commit f7246be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/builder/FormBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class FormBuilder
{
use Builder;
protected $modelClass = '';
/**
* style
* @var array
Expand Down Expand Up @@ -68,7 +68,8 @@ public static function instance($options = [])
public function __construct($options=[])
{
$this->template = $options['template']??'../../../vendor/funadmin/fun-addons/src/builder/layout/add';
;
$this->modelClass = $this->modelClass?: ($config['model'] ?? ($config['modelClass'] ?? ''));

}

/**
Expand Down Expand Up @@ -576,15 +577,14 @@ public function style(string $name,$options=[]){
*/
public function assign($data=[]){
$form = $this;
View::assign([
View::assign(array_merge([
'formBuilder'=>$form,
'formStyle'=>implode('',$this->style),
'formLink'=>implode('',$this->link),
'formScript'=>implode('',$this->script),
'formJs'=>implode('',$this->js),
'formHtml'=>implode('',$this->formHtml),
'formData'=>$data,
]);
],$data));
return $this;
}

Expand Down
7 changes: 3 additions & 4 deletions src/builder/TableBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private function __construct(array $config = [])
$this->fields = $config['fields'] ?? [];
// 初始化
$this->template = $config['template'] ?? '../../../vendor/funadmin/fun-addons/src/builder/layout/table';
$this->modelClass = $config['model'] ?? ($config['modelClass'] ?? '');
$this->modelClass = $this->modelClass?: ($config['model'] ?? ($config['modelClass'] ?? ''));
$this->driver = $config['driver'] ?? 'mysql';
$this->tablePrefix = config('database.connections.' . $this->driver . '.prefix');
$this->database = Config::get('database.connections' . '.' . $this->driver . '.database');
Expand Down Expand Up @@ -591,7 +591,7 @@ public function toolbar($buttons = [], string $tableId = 'list')
*/
public function assign(array $data = [])
{
View::assign([
View::assign(array_merge([
'node' => implode(' ', $this->node),
'options' => $this->options,
'requests' => $this->requests,
Expand All @@ -600,8 +600,7 @@ public function assign(array $data = [])
'extraJs' => $this->extraJs,
'tableStyle' => $this->style,
'tableLink' => $this->link,
'data' => $data,
]);
],$data));
return $this;
}

Expand Down

0 comments on commit f7246be

Please sign in to comment.