I am having a problem with values with '@' signs in laravel form select. It seems that all string that has '@' is being transformed into code. But this only happens on the server (which a centOS server). but works properly on my local machine.
The picture below is how is should be and is working on my local.
Then this is how it is in CentOS server
How can I fixed this? Is it in the setup of the server or I need to have a catch for this? I've tried to put an htmlentities for their values but still works like that. Not really sure what is causing it to not work in centOS. Thanks for your replies.
This is how the json object was formulated in a config file.
'group'=>[
'type'=>'choice',
'optional'=>[
'label' => 'Group',
'choices'=>function(){
return Modules\Group\Entities\Group::all()->lists('name','id')->toArray();
},
// 'multiple' => true,
'attr' => ['multiple' => 'multiple', 'class' =>'multiselect-checkbox']
]
],
And this is the view on how they are rendered. It is a php file not a blade file.
<?= Form::select($name, (array)$emptyVal + $options['choices'], $options['selected'], $options['attr']) ?>
You are using the wrong tag <?= ?>
in blade use braces in stead {!! !!}
or {{ }}
all depends on your strategy, I suggest you to look at the documentation.
Your code should be like this:
{!! Form::select($name, (array)$emptyVal + $options['choices'],
$options['selected'], $options['attr']) !!}
By default, Blade {{ }} statements are automatically sent through PHP's htmlentities function to prevent XSS attacks.
Please check documentation.
Thx to @Jonathon aware me for {!! !!}
I was to fast on the keys.