first
This commit is contained in:
58
modules/User/Http/Controllers/Admin/StockLogController.php
Normal file
58
modules/User/Http/Controllers/Admin/StockLogController.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\User\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Encore\Admin\Grid;
|
||||
use Encore\Admin\Layout\Content;
|
||||
use Modules\Gout\Models\GoutCase;
|
||||
use Modules\User\Models\UserStock;
|
||||
use Modules\User\Models\UserStockLog;
|
||||
|
||||
class StockLogController extends Controller
|
||||
{
|
||||
|
||||
protected $title = '库存记录';
|
||||
|
||||
public function index(Content $content, UserStock $stock)
|
||||
{
|
||||
return $content
|
||||
->header($stock->user->info->nickname)
|
||||
->description('库存记录')
|
||||
->body($this->grid($stock));
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes : 用户管理列表
|
||||
*
|
||||
* @Date : 2021/3/11 1:59 下午
|
||||
* @Author : <Jason.C>
|
||||
* @return Grid
|
||||
*/
|
||||
public function grid($stock): Grid
|
||||
{
|
||||
$grid = new Grid(new UserStockLog());
|
||||
|
||||
$grid->disableCreateButton();
|
||||
$grid->disableActions();
|
||||
|
||||
$grid->model()->where('user_stock_id', $stock->id)->with(['userStock']);
|
||||
|
||||
$grid->column('id', 'ID');
|
||||
$grid->column('身份')
|
||||
->display(function () {
|
||||
if ($this->identity) {
|
||||
return $this->identity->name;
|
||||
} else {
|
||||
return '---';
|
||||
}
|
||||
});
|
||||
$grid->column('type', '类型')
|
||||
->using(UserStockLog::TYPES)
|
||||
->label();
|
||||
$grid->column('variable', '数量');
|
||||
$grid->column('created_at', '操作时间');
|
||||
return $grid;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user