<?php
|
|
|
|
namespace App\Admin\Controllers;
|
|
|
|
use App\BilibiliUpVideos;
|
|
use Encore\Admin\Controllers\AdminController;
|
|
use Encore\Admin\Form;
|
|
use Encore\Admin\Grid;
|
|
use Encore\Admin\Show;
|
|
|
|
class BilibiliUpVideosController extends AdminController
|
|
{
|
|
/**
|
|
* Title for current resource.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $title = 'BilibiliUpVideos';
|
|
|
|
/**
|
|
* Make a grid builder.
|
|
*
|
|
* @return Grid
|
|
*/
|
|
protected function grid()
|
|
{
|
|
$grid = new Grid(new BilibiliUpVideos());
|
|
|
|
$grid->column('id', __('Id'));
|
|
$grid->column('mid', __('Mid'));
|
|
$grid->column('up_name', __('Up name'));
|
|
// $grid->column('videos', __('Videos'));
|
|
// $grid->column('downloaded_videos', __('Downloaded videos'));
|
|
$grid->column('local_path', __('Local path'))->editable();
|
|
$grid->column('remote_path', __('Remote path'))->editable();
|
|
$grid->column('is_available', __('Is available'));
|
|
$grid->column('is_downloaded', __('Is downloaded'));
|
|
$grid->column('created_at', __('Created at'));
|
|
$grid->column('updated_at', __('Updated at'));
|
|
|
|
return $grid;
|
|
}
|
|
|
|
/**
|
|
* Make a show builder.
|
|
*
|
|
* @param mixed $id
|
|
* @return Show
|
|
*/
|
|
protected function detail($id)
|
|
{
|
|
$show = new Show(BilibiliUpVideos::findOrFail($id));
|
|
|
|
$show->field('id', __('Id'));
|
|
$show->field('mid', __('Mid'));
|
|
$show->field('up_name', __('Up name'));
|
|
$show->field('videos', __('Videos'));
|
|
$show->field('downloaded_videos', __('Downloaded videos'));
|
|
$show->field('local_path', __('Local path'));
|
|
$show->field('remote_path', __('Remote path'));
|
|
$show->field('is_available', __('Is available'));
|
|
$show->field('is_downloaded', __('Is downloaded'));
|
|
$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 BilibiliUpVideos());
|
|
|
|
$form->number('mid', __('Mid'));
|
|
$form->text('up_name', __('Up name'));
|
|
$form->textarea('videos', __('Videos'));
|
|
$form->textarea('downloaded_videos', __('Downloaded videos'));
|
|
$form->text('local_path', __('Local path'));
|
|
$form->text('remote_path', __('Remote path'));
|
|
$form->switch('is_available', __('Is available'));
|
|
$form->switch('is_downloaded', __('Is downloaded'));
|
|
|
|
return $form;
|
|
}
|
|
}
|