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?

Laravelの@yieldって何?

0
Last updated at Posted at 2025-12-27

Laravelの@yieldって何なん?

UdemyでLaravelを学習していて@yieldっていう言葉が出てきたので備忘録

要は"子ビューが差し込まれる“穴”を親ビューに用意するもの"

【親ビュー】

   @yield('content')

↑これでViewファイルを差し込む穴を作った。

【子ビュー】

@extends('layouts.default')

@section('content')
    <p>
        Laravelの学習をはじめての方をサポートする学習サイトです<br>
        このサイトではLaravelの基礎だけでなく開発環境構築やデータベースに関しても解説します<br>
        これから学習を始めるににあたりまずは下記の内容をご確認下さい<br>
        ~~~~ 以下省略 ~~~~
    </p>
@endsection

上記では差し込む用の子を作った(index.blade.php)。

defalut.blade.phpで表示してみる

スクリーンショット 2025-12-28 062931.png

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?