定数をどこに書いたらいいかわからなかったのでググってみたら
https://tech.shellingsoft.com/2018/02/02/laravel-5-5-%E3%81%A7%E5%AE%9A%E6%95%B0%E3%82%92%E7%94%A8%E6%84%8F%E3%81%99%E3%82%8B%E3%80%82/
の通りらしい。
app/config ディレクトリに
const.php を作成して下記のようにする。
return [
'BASE_URL' => 'https://example.com',
'DIRECTRY_NAME' => ['/aaa', '/bbb', '/ccc'],
'APP_SETTING' => [
'user' => 'hogehoge',
'password' => '123456'
],
];
呼び出しは
config('const.BASE_URL'); // https://example.com
config('const.DIRECTRY_NAME.0'); // /aaa
config('const.DIRECTRY_NAME')[0]; // /aaa
config('const.APP_SETTING.user'); // hogehoge
config('const.APP_SETTING')['user']; // hogehoge
となる。
Laravelのどこからでも呼び出すことができる。はずw