first
This commit is contained in:
34
modules/Mall/Http/Controllers/Admin/Selectable/Expresses.php
Normal file
34
modules/Mall/Http/Controllers/Admin/Selectable/Expresses.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Mall\Http\Controllers\Admin\Selectable;
|
||||
|
||||
use Encore\Admin\Grid\Filter;
|
||||
use Encore\Admin\Grid\Selectable;
|
||||
use Modules\Mall\Models\Express;
|
||||
|
||||
class Expresses extends Selectable
|
||||
{
|
||||
public $model = Express::class;
|
||||
|
||||
public function make()
|
||||
{
|
||||
$this->column('id', '#ID#');
|
||||
$this->column('name', '物流名称');
|
||||
$this->column('status', '状态')->bool();
|
||||
$this->column('created_at', '时间');
|
||||
|
||||
$this->filter(function (Filter $filter) {
|
||||
$filter->like('name', '物流名称');
|
||||
});
|
||||
}
|
||||
|
||||
public static function display()
|
||||
{
|
||||
return function ($value) {
|
||||
if (is_array($value)) {
|
||||
return implode(';', array_column($value, 'name'));
|
||||
}
|
||||
return optional($this->expresses)->name;
|
||||
};
|
||||
}
|
||||
}
|
||||
32
modules/Mall/Http/Controllers/Admin/Selectable/Reasons.php
Normal file
32
modules/Mall/Http/Controllers/Admin/Selectable/Reasons.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Mall\Http\Controllers\Admin\Selectable;
|
||||
|
||||
use Encore\Admin\Grid\Selectable;
|
||||
use Modules\Mall\Models\Reason;
|
||||
|
||||
class Reasons extends Selectable
|
||||
{
|
||||
|
||||
public $model = Reason::class;
|
||||
|
||||
public function make()
|
||||
{
|
||||
$this->column('id', '#ID#');
|
||||
$this->column('title', '名称');
|
||||
$this->column('status', '状态')->bool();
|
||||
$this->column('created_at', '时间');
|
||||
}
|
||||
|
||||
public static function display()
|
||||
{
|
||||
return function ($value) {
|
||||
if (is_array($value)) {
|
||||
return implode(';', array_column($value, 'title'));
|
||||
}
|
||||
|
||||
return optional($this->reaons)->name;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user