@darrion.kuhn
To return an array in a configuration file in Laravel, you can define the array directly in the configuration file and then return it using the config()
helper function.
Here's an example of how you can do this:
1 2 3 4 5 6 7 8 |
return [ 'key1' => 'value1', 'key2' => 'value2', 'nested' => [ 'key3' => 'value3', 'key4' => 'value4', ], ]; |
1
|
$array = config('custom'); |
Now, the $array
variable will contain the array defined in the custom.php
configuration file. You can access the values in the array using the keys like $array['key1']
, $array['nested']['key3']
, etc.