调整标签类型
parent
298e5f20f8
commit
662bb57ddb
|
|
@ -4,6 +4,7 @@ namespace App\Admin\Controllers;
|
|||
|
||||
use App\Admin\Repositories\Tag;
|
||||
use App\Exceptions\BizException;
|
||||
use App\Models\Tag as TagModel;
|
||||
use App\Models\Taggable;
|
||||
use Dcat\Admin\Admin;
|
||||
use Dcat\Admin\Form;
|
||||
|
|
@ -24,9 +25,9 @@ class TagController extends AdminController
|
|||
return Grid::make(new Tag(), function (Grid $grid) {
|
||||
$grid->column('id')->sortable();
|
||||
$grid->column('type')->using([
|
||||
1=>'订单',
|
||||
2=>'货运',
|
||||
3=>'售后',
|
||||
TagModel::TYPE_ORDER =>'订单',
|
||||
TagModel::TYPE_PACKAGE=>'货运',
|
||||
// TagModel::TYPE_AFTER_SALE=>'售后',
|
||||
])->label();
|
||||
$grid->column('name');
|
||||
$grid->column('created_at')->sortable();
|
||||
|
|
@ -52,9 +53,9 @@ class TagController extends AdminController
|
|||
$filter->panel();
|
||||
$filter->expand(false);
|
||||
$filter->equal('type')->select([
|
||||
1=>'订单',
|
||||
2=>'货运',
|
||||
3=>'售后',
|
||||
TagModel::TYPE_ORDER =>'订单',
|
||||
TagModel::TYPE_PACKAGE =>'货运',
|
||||
// 3=>'售后',
|
||||
])->width(3);
|
||||
});
|
||||
});
|
||||
|
|
@ -89,9 +90,9 @@ class TagController extends AdminController
|
|||
$type = Request::Input('type', 0);
|
||||
$form->display('id');
|
||||
$form->radio('type')->options([
|
||||
1=>'订单',
|
||||
2=>'货运',
|
||||
3=>'售后',
|
||||
TagModel::TYPE_ORDER =>'订单',
|
||||
TagModel::TYPE_PACKAGE=>'货运',
|
||||
// 3=>'售后',
|
||||
])->default($type)->required();
|
||||
$form->text('name')->required();
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,11 @@ class Tag extends Model
|
|||
use HasFactory;
|
||||
use HasDateTimeFormatter;
|
||||
|
||||
public const TYPE_ORDER = 1;
|
||||
public const TYPE_PACKAGE = 2;
|
||||
public const TYPE_AFTER_SALE = 3;
|
||||
|
||||
|
||||
// /**
|
||||
// * 标签下的订单
|
||||
// *
|
||||
|
|
@ -31,11 +36,11 @@ class Tag extends Model
|
|||
|
||||
public function scopeOrderTag()
|
||||
{
|
||||
return $this->where('type', 1);
|
||||
return $this->where('type', self::TYPE_ORDER);
|
||||
}
|
||||
|
||||
public function scopeOrderPackageTag()
|
||||
{
|
||||
return $this->where('type', 2);
|
||||
return $this->where('type', self::TYPE_PACKAGE);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue