添加广告名称和备注
parent
b2fad56348
commit
8fa4ae983c
|
|
@ -24,6 +24,7 @@ class AdController extends AdminController
|
|||
$builder = Ad::with(['address']);
|
||||
return Grid::make($builder, function (Grid $grid) {
|
||||
$grid->column('id')->sortable();
|
||||
$grid->column('name');
|
||||
$grid->column('address.name');
|
||||
$grid->column('image')->image(50, 100);
|
||||
$grid->column('sort');
|
||||
|
|
@ -43,6 +44,7 @@ class AdController extends AdminController
|
|||
->else(function (Column $column) {
|
||||
$column->bool();
|
||||
});
|
||||
$grid->column('remarks');
|
||||
$grid->column('created_at')->sortable();
|
||||
//排序
|
||||
$grid->model()->orderBy('created_at', 'desc');
|
||||
|
|
@ -101,6 +103,7 @@ class AdController extends AdminController
|
|||
return Form::make(new Ad(), function (Form $form) {
|
||||
$form->display('id');
|
||||
$form->select('address_id')->options(AdAddress::all()->pluck('name', 'id'));
|
||||
$form->text('name')->required();
|
||||
$form->image('image')
|
||||
->move('ads/'.Carbon::now()->toDateString())
|
||||
->saveFullUrl()
|
||||
|
|
@ -114,6 +117,7 @@ class AdController extends AdminController
|
|||
$form->text('jump_link');
|
||||
$form->switch('is_show');
|
||||
$form->number('sort')->min(0)->default(0);
|
||||
$form->text('remarks');
|
||||
|
||||
$form->display('created_at');
|
||||
$form->display('updated_at');
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ class AdResource extends JsonResource
|
|||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'name' => (string) $this->name,
|
||||
'remarks' => (string) $this->remarks,
|
||||
'image' => (string) $this->image,
|
||||
'jump_type' => $this->jump_type,
|
||||
'jump_link' => (string) $this->jump_link,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddNameAndRemarksToAdsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ads', function (Blueprint $table) {
|
||||
//
|
||||
$table->string('name')->comment('广告名称');
|
||||
$table->string('remarks')->nullable()->comment('备注');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ads', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn(['name', 'remarks']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -6,12 +6,14 @@ return [
|
|||
'ad' => '广告',
|
||||
],
|
||||
'fields' => [
|
||||
'name'=>'名称',
|
||||
'address_id' => '广告位',
|
||||
'image' => '图片地址',
|
||||
'sort' => '广告排序',
|
||||
'jump_type' => '跳转类型',
|
||||
'jump_link' => '跳转地址',
|
||||
'is_show' => '显示',
|
||||
'remarks' => '备注',
|
||||
'address'=>[
|
||||
'name'=>'广告位',
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in New Issue