1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace App\Admin\Controllers;
- use App\Models\NewMediaAccount;
- use App\Models\NewMediaCount;
- use Encore\Admin\Controllers\AdminController;
- use Encore\Admin\Form;
- use Encore\Admin\Grid;
- use Encore\Admin\Show;
- class NewMediaCountController extends AdminController
- {
- /**
- * Title for current resource.
- *
- * @var string
- */
- protected $title = '新媒体账号播放统计';
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- $grid = new Grid(new NewMediaCount());
- $grid->column('id', __('Id'));
- $grid->column('day', __('月份'));
- $grid->column('num', __('总计播放量'));
- $grid->column('created_at', __('导入时间'));
-
- return $grid;
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- * @return Show
- */
- protected function detail($id)
- {
- $show = new Show(NewMediaAccount::findOrFail($id));
- $show->field('id', __('Id'));
- $show->field('account_name', __('账号名称'));
- $show->field('account_platform', __('账号平台'))->using(NewMediaAccount::PLATFORM_MAP);
- $show->field('fans_num', __('粉丝数'));
- $show->field('created_at', __('Created at'));
- $show->field('updated_at', __('Updated at'));
- return $show;
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- $form = new Form(new NewMediaCount());
- $form->select('year', __('年份'))->options(array_combine(range(2024,date('Y')), range(2024,date('Y'))));
- $form->select('month','月份')->options(array_combine(range(1,12), range(1,12)));
- $form->file('count_file','统计文件')->rules('mimes:xlsx');
-
- $form->keyValue('count_data','统计数据');
- return $form;
- }
- }
|