3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

LaravelでConfigファイルをサブディレクトリに作成する

Last updated at Posted at 2019-08-07

##やりたいこと

test.phpという設定ファイルをconfig/Sampleディレクトリ配下に配置する。

config
├Sample-test.php
のようにconfigファイルをサブディレクトリに配置した時の利用方法

##環境

$ php --version
PHP 7.1.30 (cli) (built: May 28 2019 15:32:26) ( ZTS MSVC14 (Visual C++ 2015) x64 )

$ php artisan --version
Laravel Framework 5.8.30

##コード
利用したい場所で下記コードを書くだけ。

Config::get(('Sample.test.***);
***には通常通りキーを指定
3
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?