李帅

1.优化脚本和readme

<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\AudioShow;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class AudioShowController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new AudioShow(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('image_url');
$grid->column('image_size');
$grid->column('audio_url');
$grid->column('audio_size');
$grid->column('audio_time');
$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 AudioShow(), function (Show $show) {
$show->field('id');
$show->field('image_url');
$show->field('image_size');
$show->field('audio_url');
$show->field('audio_size');
$show->field('audio_time');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new AudioShow(), function (Form $form) {
$form->display('id');
$form->text('image_url');
$form->text('image_size');
$form->text('audio_url');
$form->text('audio_size');
$form->text('audio_time');
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUserShowTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_show', function (Blueprint $table) {
$table->increments('id');
$table->unsignedBigInteger('user_id')->comment('用户id');
$table->text('content')->comment('内容描述');
$table->unsignedTinyInteger('type')->comment('1=图文,2=视频');
$table->unsignedBigInteger('pick_id')->index()->comment('引用的秀id');
$table->integer('fav_num')->comment('收藏数');
$table->integer('view_num')->comment('观看数');
$table->integer('praise_num')->comment('点赞数');
$table->integer('comment_num')->comment('评论数');
$table->unsignedBigInteger('child_id')->comment('图文/视频表id');
$table->unsignedTinyInteger('state')->comment('状态');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_show');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAudioShowTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('audio_show', function (Blueprint $table) {
$table->increments('id');
$table->unsignedBigInteger('user_id')->index()->comment('用户id');
$table->string('image_url')->default('')->comment('图片地址');
$table->string('image_size')->default('')->comment('图片大小');
$table->string('audio_url')->default('')->comment('音频地址');
$table->string('audio_size')->default('')->comment('音频大小');
$table->string('audio_time')->default('')->comment('音频时长');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('audio_show');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateVideoShowTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('video_show', function (Blueprint $table) {
$table->increments('id');
$table->unsignedBigInteger('user_id')->index()->comment('用户id');
$table->string('video_url')->default('')->comment('视频地址');
$table->string('video_size')->default('')->comment('视频大小');
$table->string('video_time')->default('')->comment('视频时长');
$table->unsignedTinyInteger('is_horizontal')->comment('1=横版,2=竖版');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('video_show');
}
}