6 changed files with 180 additions and 0 deletions
-
86app/Admin/Controllers/ServicePersonnelController.php
-
16app/Admin/Repositories/ServicePersonnel.php
-
16app/Models/ServicePersonnel.php
-
40database/migrations/2020_09_14_120733_create_lanzu_service_personnel_table.php
-
4dcat_admin_ide_helper.php
-
18resources/lang/zh-CN/service-personnel.php
@ -0,0 +1,86 @@ |
|||
<?php |
|||
|
|||
namespace App\Admin\Controllers; |
|||
|
|||
use App\Admin\Repositories\ServicePersonnel; |
|||
use Dcat\Admin\Form; |
|||
use Dcat\Admin\Grid; |
|||
use Dcat\Admin\Show; |
|||
use Dcat\Admin\Controllers\AdminController; |
|||
|
|||
class ServicePersonnelController extends AdminController |
|||
{ |
|||
/** |
|||
* Make a grid builder. |
|||
* |
|||
* @return Grid |
|||
*/ |
|||
protected function grid() |
|||
{ |
|||
return Grid::make(new ServicePersonnel(), function (Grid $grid) { |
|||
$grid->column('id')->sortable(); |
|||
$grid->column('user_id'); |
|||
$grid->column('name'); |
|||
$grid->column('tel'); |
|||
$grid->column('market_id'); |
|||
$grid->column('type'); |
|||
$grid->column('status'); |
|||
$grid->column('qr_url'); |
|||
$grid->column('head_url'); |
|||
$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 ServicePersonnel(), function (Show $show) { |
|||
$show->field('id'); |
|||
$show->field('user_id'); |
|||
$show->field('name'); |
|||
$show->field('tel'); |
|||
$show->field('market_id'); |
|||
$show->field('type'); |
|||
$show->field('status'); |
|||
$show->field('qr_url'); |
|||
$show->field('head_url'); |
|||
$show->field('created_at'); |
|||
$show->field('updated_at'); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Make a form builder. |
|||
* |
|||
* @return Form |
|||
*/ |
|||
protected function form() |
|||
{ |
|||
return Form::make(new ServicePersonnel(), function (Form $form) { |
|||
$form->display('id'); |
|||
$form->text('user_id'); |
|||
$form->text('name'); |
|||
$form->text('tel'); |
|||
$form->text('market_id'); |
|||
$form->text('type'); |
|||
$form->text('status'); |
|||
$form->text('qr_url'); |
|||
$form->text('head_url'); |
|||
|
|||
$form->display('created_at'); |
|||
$form->display('updated_at'); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
<?php |
|||
|
|||
namespace App\Admin\Repositories; |
|||
|
|||
use App\Models\ServicePersonnel as Model; |
|||
use Dcat\Admin\Repositories\EloquentRepository; |
|||
|
|||
class ServicePersonnel extends EloquentRepository |
|||
{ |
|||
/** |
|||
* Model. |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $eloquentClass = Model::class; |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
<?php |
|||
|
|||
namespace App\Models; |
|||
|
|||
use Dcat\Admin\Traits\HasDateTimeFormatter; |
|||
use Illuminate\Database\Eloquent\SoftDeletes; |
|||
use Illuminate\Database\Eloquent\Model; |
|||
|
|||
class ServicePersonnel extends Model |
|||
{ |
|||
use HasDateTimeFormatter; |
|||
use SoftDeletes; |
|||
|
|||
protected $table = 'lanzu_service_personnel'; |
|||
|
|||
} |
|||
@ -0,0 +1,40 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Support\Facades\Schema; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Database\Migrations\Migration; |
|||
|
|||
class CreateLanzuServicePersonnelTable extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function up() |
|||
{ |
|||
Schema::create('lanzu_service_personnel', function (Blueprint $table) { |
|||
$table->increments('id'); |
|||
$table->unsignedInteger('user_id')->default('0')->comment('服务员懒ID'); |
|||
$table->string('name')->default('')->comment('姓名'); |
|||
$table->char('tel')->comment('电话'); |
|||
$table->tinyInteger('market_id')->default('0')->comment('所属市场'); |
|||
$table->tinyInteger('type')->default('0')->comment('类型'); |
|||
$table->tinyInteger('status')->default('0')->comment('状态'); |
|||
$table->string('qr_url')->default('0')->comment('专员二维码'); |
|||
$table->string('head_url')->default('0')->comment('头像'); |
|||
$table->timestamps(); |
|||
$table->softDeletes(); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function down() |
|||
{ |
|||
Schema::dropIfExists('lanzu_service_personnel'); |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
<?php |
|||
return [ |
|||
'labels' => [ |
|||
'ServicePersonnel' => 'ServicePersonnel', |
|||
], |
|||
'fields' => [ |
|||
'user_id' => '服务员懒ID', |
|||
'name' => '姓名', |
|||
'tel' => '电话', |
|||
'market_id' => '所属市场', |
|||
'type' => '类型', |
|||
'status' => '状态', |
|||
'qr_url' => '专员二维码', |
|||
'head_url' => '头像', |
|||
], |
|||
'options' => [ |
|||
], |
|||
]; |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue