0
0

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 1 year has passed since last update.

Laravelの@includeを、railsの部分テンプレートみたいに使いたい

Posted at

##@includeの使い方

Railsのようになんとなく使いたい。

####親側
・子供のbladeファイルを指定(ここでは、child.blade.php)
・子供に渡す変数があれば、値を渡す(ここでは、hogeとしている。)

parent_blade.php
:
:
   @include('child', [ 'hoge' => $post])
:
:

####子供側
・変数さえ貰えば、動くので、特にやることはない。

child_blade.php

<p> 記事のタイトルは{{$hoge->title}}です </p>

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?