4
2

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 5 years have passed since last update.

Laravel 5.5 Blade @appendの使い方

Last updated at Posted at 2018-01-23

Laravel5.5初心者。
bladeの@appendの使い方メモです。

@sectionの閉じ部分を@appendにすればいい。

index.blade.php
@extends('layouts.default')

@section('content')
content!<br>
@endsection

@section('content')
  contentに追記<br>
@append

結果

content!
contentに追記

element的な他のビューでも同様。

適当にincludeするビュー

test.blade.php
@section('content')
includeしたblade内からcontentを追記
@append

レイアウト

index.blade.php
@extends('layouts.default')

@section('content')
content!<br>
@endsection

@section('content')
  contentに追記<br>
@append

@include('test')

結果

content!
contentに追記
includeしたblade内からcontentを追記

こういう細かい所含めて体系的にまとまってるドキュメントはないだろうか。。
どうにも情報が細切れで散らばっている感がある。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?