Compare commits
No commits in common. "8abbca243c152d8a8ae1eb9f64abc54cbab462d1" and "16443e49e0b4e8a3a90c8c09dcd3a610dc7cc174" have entirely different histories.
8abbca243c
...
16443e49e0
|
|
@ -7,7 +7,6 @@ use Slowlyo\OwlAdmin\Renderers\Form;
|
|||
use Slowlyo\OwlAdmin\Renderers\TableColumn;
|
||||
use Slowlyo\OwlAdmin\Renderers\TextControl;
|
||||
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
||||
use Slowlyo\OwlAdmin\Renderers\Button;
|
||||
use App\Services\Admin\RegionCategoryService;
|
||||
use App\Admin\Components;
|
||||
|
||||
|
|
@ -30,14 +29,6 @@ class RegionCategoryController extends AdminController
|
|||
$this->createButton(true),
|
||||
...$this->baseHeaderToolBar(),
|
||||
])
|
||||
->filter(
|
||||
$this->baseFilter()->body([
|
||||
amisMake()->TextControl()->make('name')->label('分类名称')->name('name'),
|
||||
|
||||
Button::make()->label(__('admin.reset'))->actionType('clear-and-submit'),
|
||||
amis('submit')->label(__('admin.search'))->level('primary'),
|
||||
])->actions([])
|
||||
)
|
||||
->columns([
|
||||
TableColumn::make()->name('id')->label('ID')->sortable(true),
|
||||
TableColumn::make()->name('name')->label('名称'),
|
||||
|
|
@ -68,7 +59,6 @@ class RegionCategoryController extends AdminController
|
|||
return $this->baseDetail()->body([
|
||||
TextControl::make()->static(true)->name('id')->label('ID'),
|
||||
TextControl::make()->static(true)->name('name')->label('名称'),
|
||||
TextControl::make()->static(true)->name('description')->label('描述'),
|
||||
TextControl::make()->static(true)->name('created_at')->label('创建时间'),
|
||||
TextControl::make()->static(true)->name('updated_at')->label('更新时间')
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Filters\Admin;
|
||||
|
||||
use EloquentFilter\ModelFilter;
|
||||
|
||||
class RegionCategoryFilter extends ModelFilter
|
||||
{
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
public function name($name){
|
||||
return $this->where('name', 'like', '%'.$name.'%');
|
||||
}
|
||||
|
||||
/**
|
||||
* 父级分类
|
||||
*/
|
||||
public function parent($parentId){
|
||||
return $this->where('parent_id', $parentId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否开启
|
||||
*/
|
||||
public function isEnable($isEnable){
|
||||
return $this->where('is_enbale', $isEnable);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -13,9 +13,6 @@ class RegionCategory extends Model
|
|||
|
||||
protected $fillable = ['name', 'icon', 'description', 'parent_id', 'level', 'sort', 'path', 'is_enable'];
|
||||
|
||||
protected function serializeDate(\DateTimeInterface $date){
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Services\Admin;
|
||||
|
||||
use App\Models\RegionCategory;
|
||||
use App\Filters\Admin\RegionCategoryFilter;
|
||||
use Slowlyo\OwlAdmin\Services\AdminService;
|
||||
|
||||
/**
|
||||
|
|
@ -13,14 +12,4 @@ use Slowlyo\OwlAdmin\Services\AdminService;
|
|||
class RegionCategoryService extends AdminService
|
||||
{
|
||||
protected string $modelName = RegionCategory::class;
|
||||
|
||||
public function listQuery()
|
||||
{
|
||||
$model = $this->getModel();
|
||||
|
||||
return $this->query()
|
||||
->with('parent')
|
||||
->filter(request()->input(), RegionCategoryFilter::class)
|
||||
->orderByDesc($model->getUpdatedAtColumn() ?? $model->getKeyName());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 101 KiB |
Loading…
Reference in New Issue