12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- namespace App\Admin\Controllers\System;
- use App\Http\Controllers\Controller;
- use App\Models\EmailLog;
- use Encore\Admin\Controllers\HasResourceActions;
- use Encore\Admin\Form;
- use Encore\Admin\Grid;
- use Encore\Admin\Layout\Content;
- class EmailLogController extends Controller
- {
- use HasResourceActions;
- /**
- * Index interface.
- *
- * @param Content $content
- * @return Content
- */
- public function index(Content $content)
- {
- return $content
- ->header('邮件日志')
- ->description('')
- ->body($this->grid());
- }
- /**
- * Show interface.
- *
- * @param mixed $id
- * @param Content $content
- * @return Content
- */
- public function show($id, Content $content)
- {
- return $content
- ->header('邮件日志')
- ->description('详细')
- ->body($this->detail($id));
- }
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- $grid = new Grid(new EmailLog);
- $grid->model()->orderBy('id', 'desc');
- $grid->id('ID');
- $grid->send_from('发送账号');
- $grid->send_to('发送地址');
- $grid->subject('邮件主题');
- $grid->status('状态')->display(function ($status) {
- if ($status == 1) {
- return '成功';
- } elseif ($status==2) {
- return '失败';
- } else {
- return '待发送';
- }
- });
- $grid->created_at('添加时间');
- $grid->updated_at('更新时间');
- $grid->disableActions();
- return $grid;
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- $form = new Form(new EmailLog);
- $form->display('ID');
- $form->display('Created at');
- $form->display('Updated at');
- return $form;
- }
- }
|