PickPoetryVerseController.php
3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\PickPoetryVerse;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class PickPoetryVerseController extends AdminController
{
protected $title = '推送服务';
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new PickPoetryVerse(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('pick_id');
$grid->column('verse_id');
$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 PickPoetryVerse(), function (Show $show) {
$show->field('id');
$show->field('pick_id');
$show->field('verse_id');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new PickPoetryVerse(), function (Form $form) {
$form->display('id');
$form->block(8, function (Form\BlockForm $form) {
// 设置标题
$form->title('基本设置');
// 显示底部提交按钮
$form->showFooter();
// 设置字段宽度
$form->width(8, 3);
$form->radio('plant')->addElementClass('plant')
->options([1 => 'Android', 2 => 'IOS'])->default(2);
$form->text('title')->addElementClass('title');
$form->textarea('content')->addElementClass('push_content');
$form->radio('push_type', '发送时间')->addElementClass('push_type')
->options([1 => '立即', 2 => '定时'])->default(1)
->when(2, function (Form\BlockForm $form) {
$form->datetime('push_time');
});
$form->select('action_type')->addElementClass('action_type')
->options(['打开应用', '临境', '会员介绍页', '众妙页']);
$form->radio('user_type', '目标人群')->options([1 => '所有人', 2 => '指定用户'])->default(1)
->when(2, function (Form\BlockForm $form) {
$form->text('user_id');
});
});
$form->block(4, function (Form\BlockForm $form) {
$form->width(9, 1);
$form->html(view('admin.form.push'));
});
$form->display('created_at');
$form->display('updated_at');
});
}
public function store()
{
dd(request()->all());
}
}