LoginSignup
5
2

More than 5 years have passed since last update.

laravel5.4で定数を定義してbladeで表示する

Last updated at Posted at 2018-04-11

定数を定義

  • /config/const.phpに定義
const.php
return array(
    'constOne'=> '定数一',
    'constTwo'=> '定数二',
);

bladeで表示

  • {{Config::get('const.constOne')}}で表示
sample.blade.php
<p>{{Config::get('const.constOne')}}</p>
<p>{{Config::get('const.constTwo')}}</p>

これで、一つ目のpタグには「定数一」、二つ目のpタグには「定数二」と表示されます。

5
2
0

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
5
2