feat: permissions
This commit is contained in:
@@ -64,6 +64,10 @@ class FrontTable extends Creator
|
||||
*/
|
||||
protected string $useList = '{useList}';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected string $tree = '{tree}';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
@@ -91,13 +95,14 @@ class FrontTable extends Creator
|
||||
{
|
||||
// TODO: Implement getContent() method.
|
||||
return Str::of(File::get($this->getTableStub()))->replace([
|
||||
$this->table, $this->search, $this->api, $this->paginate, $this->useList
|
||||
$this->table, $this->search, $this->api, $this->paginate, $this->useList, $this->tree
|
||||
], [
|
||||
$this->getTableContent(),
|
||||
$this->getSearchContent(),
|
||||
$this->apiString,
|
||||
$this->getPaginateStubContent(),
|
||||
$this->getUseList()
|
||||
$this->getUseList(),
|
||||
$this->getTreeProps()
|
||||
])->toString();
|
||||
}
|
||||
|
||||
@@ -230,6 +235,20 @@ HTML;
|
||||
return 'const { data, query, search, reset, loading } = useGetList(api)';
|
||||
}
|
||||
|
||||
/**
|
||||
* get tree props
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTreeProps(): string
|
||||
{
|
||||
if (in_array('parent_id', array_column($this->structures, 'field'))) {
|
||||
return ' row-key="id" default-expand-all :tree-props="{ children: \'children\' }"';
|
||||
}
|
||||
|
||||
return ' ';
|
||||
}
|
||||
|
||||
/**
|
||||
* set structures
|
||||
*
|
||||
|
@@ -128,8 +128,11 @@ class Schema extends Creator
|
||||
|
||||
$column = $column->nullable($structure['nullable']);
|
||||
|
||||
if ($structure['default']) {
|
||||
$column = $column->default($structure['default']);
|
||||
if (is_null($structure['default'])) {
|
||||
} else {
|
||||
if (is_numeric($structure['default']) || mb_strlen($structure['default'])) {
|
||||
$column = $column->default($structure['default']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($structure['comment']) {
|
||||
@@ -206,6 +209,7 @@ class Schema extends Creator
|
||||
})
|
||||
->when(isset($structure['default']), function ($str, $default) {
|
||||
if (is_numeric($default)) {
|
||||
$default = intval($default);
|
||||
return $str->append("->default({$default})");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user