阶段更新

This commit is contained in:
2023-03-09 11:54:13 +08:00
parent e78454540f
commit 3cd75b1d6e
47 changed files with 4844 additions and 1646 deletions

View File

@@ -0,0 +1,56 @@
<?php
namespace App\Admin\Controllers\Material;
use App\Models\Material;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
class IndexController extends AdminController
{
/**
* Title for current resource.
*
* @var string
*/
protected $title = '物料/素材';
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$grid = new Grid(new Material());
$grid->column('id', '编号');
$grid->column('title', '名称');
$grid->column('地址')->display(function () {
return $this->cover_url;
});
$grid->column('created_at', '创建时间');
return $grid;
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form(): Form
{
$form = new Form(new Material());
$form->text('title', '名称');
$form->image('cover', '图片')
->move('materials/'.date('Y/m/d'))
->removable()
->required();
return $form;
}
}