LoginSignup
0
0

More than 1 year has passed since last update.

bladeの@includeの使い方

Last updated at Posted at 2023-02-24

自分の会社のコードを読んでいてわからなかったので自分のために書いておきます。

//hello.blade.php
<div>
    <p>{{ $key }}</p>
    <p>{{ $key2 }}</p>
</div>

同じ階層のHello.blade.phpを読み込みたいなら
@include('hello', ['key' => 'value','key2' => 'value2'],..)
この一行でhello.blade.phpに値を渡し、表示させることができる。

メリットとしては、hello.blade.phpを使い回すことができるという点か。。
他にもありそうですが、今日はここまで。
また何かあれば書き足すかもしれません。

0
0
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
0
0