Commit 53bf8ceb by lujunyi

修改标签

parent 259dc1bb
......@@ -2,14 +2,14 @@
namespace App\Admin\Controllers;
use App\Admin\Repositories\Tag;
use App\Admin\Repositories\DrugTagRepository;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Show;
// 药品标签
class TagController extends AdminController
class DrugTagController extends AdminController
{
/**
* Make a grid builder.
......@@ -18,7 +18,7 @@ class TagController extends AdminController
*/
protected function grid()
{
return Grid::make(new Tag(), function (Grid $grid) {
return Grid::make(new DrugTagRepository(), function (Grid $grid) {
$grid->model()->orderBy('id', 'DESC');
$grid->column('id')->sortable();
......@@ -48,11 +48,11 @@ protected function grid()
*/
protected function detail($id)
{
return Show::make($id, new Tag(), function (Show $show) {
$show->field('id');
$show->field('tag_name');
$show->field('created_at');
$show->field('updated_at');
return Show::make($id, new DrugTagRepository(), function (Show $show) {
$show->field('id')->width(4);
$show->field('tag_name')->width(4);
$show->field('created_at')->width(4);
$show->field('updated_at')->width(4);
$show->panel()->tools(function ($tools) {
$tools->disableDelete(); // 禁止删除按钮
......@@ -67,12 +67,12 @@ protected function detail($id)
*/
protected function form()
{
return Form::make(new Tag(), function (Form $form) {
$form->display('id');
$form->text('tag_name');
return Form::make(new DrugTagRepository(), function (Form $form) {
$form->display('id')->width(4);
$form->text('tag_name')->width(4);
$form->display('created_at');
$form->display('updated_at');
$form->display('created_at')->width(4);
$form->display('updated_at')->width(4);
// 右上角按钮控制
$form->disableDeleteButton(); // 去掉删除按钮
......
......@@ -2,10 +2,10 @@
namespace App\Admin\Repositories;
use App\Models\Tag as Model;
use App\Models\DrugTagModel as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Tag extends EloquentRepository
class DrugTagRepository extends EloquentRepository
{
/**
* Model.
......
......@@ -20,7 +20,7 @@
// 药品-药品
$router->resource('drug', 'DrugController');
// 药品-标签
$router->resource('tag', 'TagController');
$router->resource('drug-tag', 'DrugTagController');
// 问诊-问诊人
$router->resource('patient', 'PatientController');
......
......@@ -6,10 +6,10 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Tag extends Model
class DrugTagModel extends Model
{
use HasDateTimeFormatter;
use SoftDeletes;
protected $table = 'tag';
protected $table = 'drug_tag';
}
......@@ -13,10 +13,10 @@ class CreateTagTable extends Migration
*/
public function up()
{
Schema::create('tag', function (Blueprint $table) {
Schema::create('drug_tag', function (Blueprint $table) {
$table->comment('药品标签');
$table->bigIncrements('id');
$table->string('tag_name')->default('')->comment('标签名称');
$table->string('tag_name')->comment('标签名称');
$table->timestamps();
$table->softDeletes();
});
......@@ -29,6 +29,6 @@ public function up()
*/
public function down()
{
Schema::dropIfExists('tag');
Schema::dropIfExists('drug_tag');
}
}
<?php
return [
'labels' => [
'Tag' => 'Tag',
'tag' => 'Tag',
'DrugTag' => '药品标签',
'drug-tag' => '药品标签',
],
'fields' => [
'tag_name' => '标签名称',
......
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