[英]Laravel Backpack uppercase
I am trying to have a column where我正在尝试有一个专栏
If I am doing this through an accessor, then this won't be a tableColumn and it won't be orderable.如果我通过访问器执行此操作,那么这将不是 tableColumn 并且不可订购。 So this wont work.
所以这行不通。
Next I am trying to find a way to make it uppercase in blade?接下来我试图找到一种方法在刀片中使其大写? For example, I am setting a column->toUpper = true;
例如,我正在设置一个 column->toUpper = true;
$this->crud->addColumn(
[
'name' => 'country',
'label' => 'Country,
'type' => 'text',
'toUpper' => true
]);
Where in blade can I search for this and transform the value?我可以在刀片中的哪个位置搜索并转换值?
Or how should I do this?或者我应该怎么做? Looks like an easy task but I cant find it in the docs.
看起来很容易,但我在文档中找不到。
Edit Changing this to a modelFunction will disable other functionality like search.编辑将此更改为 modelFunction 将禁用其他功能,例如搜索。 So really what we need is to have the field like a db column and retain all the associated functionalities (search sort etc) and make it uppercase in Blade as it is a display issue.
所以我们真正需要的是拥有像 db 列这样的字段并保留所有相关的功能(搜索排序等)并在 Blade 中将其设为大写,因为它是一个显示问题。
You can use您可以使用
CRUD::column('text_and_email')
->type('model_function')
->label('Text and Email')
->function_name('getUpperText')
And add in model function并添加 model function
public function getUpperText() {
return strtoupper($this->field);
}
You can directly use bootstrap text-uppercase
class on the column wrapper to get the desired output:您可以直接在列包装器上使用 bootstrap
text-uppercase
class 来获得所需的 output:
$this->crud->addColumn(
[
'name' => 'country',
'label' => 'Country,
'type' => 'text',
'wrapper' => [
'class' => 'text-uppercase'
],
]);
Cheers干杯
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.