|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Tests\Controllers; |
|
4
|
|
|
|
|
5
|
|
|
use App\Http\Controllers\Controller; |
|
6
|
|
|
use Encore\Admin\Controllers\ModelForm; |
|
7
|
|
|
use Encore\Admin\Facades\Admin; |
|
8
|
|
|
use Encore\Admin\Form; |
|
9
|
|
|
use Encore\Admin\Grid; |
|
10
|
|
|
use Encore\Admin\Layout\Content; |
|
11
|
|
|
use Tests\Models\File; |
|
12
|
|
|
|
|
13
|
|
|
class FileController extends Controller |
|
14
|
|
|
{ |
|
15
|
|
|
use ModelForm; |
|
|
|
|
|
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Index interface. |
|
19
|
|
|
* |
|
20
|
|
|
* @return Content |
|
21
|
|
|
*/ |
|
22
|
|
|
public function index() |
|
23
|
|
|
{ |
|
24
|
|
|
return Admin::content(function (Content $content) { |
|
25
|
|
|
$content->header('header'); |
|
26
|
|
|
$content->description('description'); |
|
27
|
|
|
|
|
28
|
|
|
$content->body($this->grid()); |
|
29
|
|
|
}); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Edit interface. |
|
34
|
|
|
* |
|
35
|
|
|
* @param $id |
|
36
|
|
|
* |
|
37
|
|
|
* @return Content |
|
38
|
|
|
*/ |
|
39
|
|
View Code Duplication |
public function edit($id) |
|
|
|
|
|
|
40
|
|
|
{ |
|
41
|
|
|
return Admin::content(function (Content $content) use ($id) { |
|
42
|
|
|
$content->header('header'); |
|
43
|
|
|
$content->description('description'); |
|
44
|
|
|
|
|
45
|
|
|
$content->body($this->form()->edit($id)); |
|
46
|
|
|
}); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Create interface. |
|
51
|
|
|
* |
|
52
|
|
|
* @return Content |
|
53
|
|
|
*/ |
|
54
|
|
|
public function create() |
|
55
|
|
|
{ |
|
56
|
|
|
return Admin::content(function (Content $content) { |
|
57
|
|
|
$content->header('Upload file'); |
|
58
|
|
|
|
|
59
|
|
|
$content->body($this->form()); |
|
60
|
|
|
}); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Make a grid builder. |
|
65
|
|
|
* |
|
66
|
|
|
* @return Grid |
|
67
|
|
|
*/ |
|
68
|
|
|
protected function grid() |
|
69
|
|
|
{ |
|
70
|
|
|
return Admin::grid(File::class, function (Grid $grid) { |
|
71
|
|
|
$grid->id('ID')->sortable(); |
|
|
|
|
|
|
72
|
|
|
|
|
73
|
|
|
$grid->created_at(); |
|
|
|
|
|
|
74
|
|
|
$grid->updated_at(); |
|
|
|
|
|
|
75
|
|
|
}); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Make a form builder. |
|
80
|
|
|
* |
|
81
|
|
|
* @return Form |
|
82
|
|
|
*/ |
|
83
|
|
|
protected function form() |
|
84
|
|
|
{ |
|
85
|
|
|
return Admin::form(File::class, function (Form $form) { |
|
86
|
|
|
$form->display('id', 'ID'); |
|
87
|
|
|
|
|
88
|
|
|
$form->file('file1'); |
|
89
|
|
|
$form->file('file2'); |
|
90
|
|
|
$form->file('file3'); |
|
91
|
|
|
$form->file('file4'); |
|
92
|
|
|
$form->file('file5'); |
|
93
|
|
|
$form->file('file6'); |
|
94
|
|
|
|
|
95
|
|
|
$form->display('created_at', 'Created At'); |
|
96
|
|
|
$form->display('updated_at', 'Updated At'); |
|
97
|
|
|
}); |
|
98
|
|
|
} |
|
99
|
|
|
} |
|
100
|
|
|
|
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.