60 lines
2.1 KiB
PHP
60 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Controllers;
|
|
|
|
use Slowlyo\OwlAdmin\Renderers\Page;
|
|
use Slowlyo\OwlAdmin\Renderers\Form;
|
|
use Slowlyo\OwlAdmin\Renderers\TableColumn;
|
|
use Slowlyo\OwlAdmin\Renderers\TextControl;
|
|
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
|
use App\Services\Admin\FriendLinkService;
|
|
use App\Admin\Components;
|
|
|
|
class FriendLinkController extends AdminController
|
|
{
|
|
protected string $serviceName = FriendLinkService::class;
|
|
|
|
protected string $pageTitle = '友情链接';//待完善-todo
|
|
|
|
public function list(): Page
|
|
{
|
|
$crud = $this->baseCRUD()
|
|
->filterTogglable(false)
|
|
->headerToolbar([
|
|
$this->createButton(true),
|
|
...$this->baseHeaderToolBar(),
|
|
])
|
|
->columns([
|
|
TableColumn::make()->name('id')->label('ID')->sortable(true),
|
|
TableColumn::make()->name('name')->label('名称'),
|
|
TableColumn::make()->name('created_at')->label('创建时间')->type('datetime')->sortable(true),
|
|
TableColumn::make()->name('updated_at')->label('更新时间')->type('datetime')->sortable(true),
|
|
$this->rowActions(true),
|
|
]);
|
|
|
|
return $this->baseList($crud);
|
|
}
|
|
|
|
public function form(): Form
|
|
{
|
|
return $this->baseForm()->body([
|
|
TextControl::make()->name('name')->label('名称'),
|
|
TextControl::make()->name('path')->label('链接')->required(true),
|
|
amisMake()->ImageControl()->name('icon')->label('icon')->autoUpload(true),
|
|
Components::make()->sortControl(),
|
|
amisMake()->SwitchControl()->name('is_recommend')->label('推荐'),
|
|
amisMake()->SwitchControl()->name('is_enable')->label('显示'),
|
|
]);
|
|
}
|
|
|
|
public function detail(): Form
|
|
{
|
|
return $this->baseDetail()->body([
|
|
TextControl::make()->static(true)->name('id')->label('ID'),
|
|
TextControl::make()->static(true)->name('name')->label('名称'),
|
|
TextControl::make()->static(true)->name('created_at')->label('创建时间'),
|
|
TextControl::make()->static(true)->name('updated_at')->label('更新时间')
|
|
]);
|
|
}
|
|
}
|