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!
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()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With