Reputation: 2428
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. 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;
$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. 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.
Upvotes: 1
Views: 515
Reputation: 1071
You can directly use bootstrap text-uppercase
class on the column wrapper to get the desired output:
$this->crud->addColumn(
[
'name' => 'country',
'label' => 'Country,
'type' => 'text',
'wrapper' => [
'class' => 'text-uppercase'
],
]);
Cheers
Upvotes: 0
Reputation: 179
You can use
CRUD::column('text_and_email')
->type('model_function')
->label('Text and Email')
->function_name('getUpperText')
And add in model function
public function getUpperText() {
return strtoupper($this->field);
}
UPD:
We can change by CSS We can add custom class to column by use ne
'attributes' => [
'class' => 'some-class'
]
and use CSS
text-transform: uppercase;
Upvotes: 3
Reputation: 1
use Illuminate\Support\Str;
$string = Str::upper('QandeelAcademy');
Use this method when you are fetching the data from the database Read this
Upvotes: -1