Issue
i want to get config value in blade.
config/define.php
<?php
return [
'show' => array(1 => 'Show',0 => 'Hide' ),
];
I found a code
{{ Config::get('define.show') }}
But i want use:
{{ $showarray = Config::get('define.show') }}
@foreach ($master as $pt)
{{ $showarray[$pt->show_flag] }}
@endforeach
But it does not work. Help me please!
Solution
You can do it by -
@foreach ($master as $pt)
{{ Config::get('define.show.' . $pt->show_flag) }} // concatenate the value
@endforeach
Or by using @php
tag -
@php
$showarray = Config::get('define.show');
@endphp
@foreach ($master as $pt)
{{ $showarray[$pt->show_flag] }}
@endforeach
You can also access the configs by using config()
.
Answered By - Sougata Bose
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.