gpt4 book ai didi

php - Laravel,Yajra 数据表,如何返回 if y then Yes else No

转载 作者:行者123 更新时间:2023-12-01 07:38:00 25 4
gpt4 key购买 nike

我在国家/地区表中显示了列名称,现在我使用 yajra 数据表,所以我如何查看 yes 而不是 y 以及 , No if n

 $data = $this->SourceData->getData();
return Datatables::of($data)
->addIndexColumn()

->addColumn('Actions', function($data) {...})
->rawColumns(['Actions'])
->make(true);

jquery

       columns: [
{data: 'id', name: 'id', visible:false},
{data: 'DT_RowIndex', name: 'DT_RowIndex'},
{data: 'name', name: 'name'},
{data: 'code', name: 'code'},
{data: 'show', name: 'show'},
{data: 'Actions', name: 'Actions',orderable:false,serachable:false,sClass:'text-center'},

最佳答案

请检查此代码

$data = $this->SourceData->getData();

return Datatables::of($data)
->addIndexColumn()
->editColumn('show', function ($data) {
return ($data->show == 'y')?"Yes":($data->show == 'n')?"No":"";
})
->addColumn('Actions', function($data) {...})
->rawColumns(['Actions'])
->make(true);

关于php - Laravel,Yajra 数据表,如何返回 if y then Yes else No,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59839221/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com