first push
This commit is contained in:
68
app/Admin/Controllers/Link/IndexController.php
Normal file
68
app/Admin/Controllers/Link/IndexController.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?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');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user