69 lines
1.5 KiB
PHP
69 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Controllers\Link;
|
|
|
|
use App\Models\Link;
|
|
use Dcat\Admin\Form;
|
|
use Dcat\Admin\Grid;
|
|
use Dcat\Admin\Show;
|
|
use Dcat\Admin\Controllers\AdminController;
|
|
|
|
class IndexController extends AdminController
|
|
{
|
|
|
|
protected $title = '友情链接';
|
|
|
|
/**
|
|
* Make a grid builder.
|
|
* @return Grid
|
|
*/
|
|
protected function grid()
|
|
{
|
|
return Grid::make(new Link(), function (Grid $grid) {
|
|
$grid->column('id')->sortable();
|
|
$grid->column('title');
|
|
$grid->column('url');
|
|
$grid->column('created_at');
|
|
$grid->column('updated_at')->sortable();
|
|
|
|
$grid->filter(function (Grid\Filter $filter) {
|
|
$filter->equal('id');
|
|
|
|
});
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Make a show builder.
|
|
* @param mixed $id
|
|
* @return Show
|
|
*/
|
|
protected function detail($id)
|
|
{
|
|
return Show::make($id, new Link(), function (Show $show) {
|
|
$show->field('id');
|
|
$show->field('title');
|
|
$show->field('url');
|
|
$show->field('created_at');
|
|
$show->field('updated_at');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Make a form builder.
|
|
* @return Form
|
|
*/
|
|
protected function form()
|
|
{
|
|
return Form::make(new Link(), function (Form $form) {
|
|
$form->display('id');
|
|
$form->text('title');
|
|
$form->text('url');
|
|
|
|
$form->display('created_at');
|
|
$form->display('updated_at');
|
|
});
|
|
}
|
|
|
|
}
|