Commit e9bdc8d7 by 赵增煜

新增症状表

parent 938eaaea
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\Symptom;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class SymptomController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Symptom(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('name');
$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 Symptom(), function (Show $show) {
$show->field('id');
$show->field('id');
$show->field('name');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Symptom(), function (Form $form) {
$form->display('id');
$form->text('name');
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Repositories;
use App\Models\Symptom as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Symptom extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
class Symptom extends Model
{
use HasDateTimeFormatter;
use SoftDeletes;
protected $table = 'symptom';
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSymptomTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('symptom', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name')->default('');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('symptom');
}
}
<?php
return [
'labels' => [
'Symptom' => 'Symptom',
'symptom' => 'Symptom',
],
'fields' => [
'id' => '症状编号',
'name' => '症状名称',
],
'options' => [
],
];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment