resources/viewsの中に共通化コンポーネントを作成する
ああああああああああ、cake.phpを思い出してきた。。。
default.blade.php
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>@yield('title')</title>
<link rel="stylesheet" href="/css/styles.css">
</head>
<body>
<div class="container">
@yield('content')
</div>
</body>
</html>
index.blade.php
@extends('layouts.default')
{{--
@section('title')
Blog Posts
@endsection
--}}
@section('title', 'Blog Posts')
@section('container')
<h1>Blog Posts</h1>
<ul>
{{--
@foreach ($posts as $post)
<li><a href="">{{ $post->title }}</a></li>
@endforeach
--}}
@forelse ($posts as $post)
<li><a href="{{ action('PostsController@show', $post) }}">{{ $post->title }}</a></li>
@empty
<li>No posts yet</li>
@endforelse
</ul>
@endsection
show.blade.php
@extends('layouts.default')
@section('title', $post->title)
@section('container')
<h1>{{ $post->title }}</h1>
<p>{!! nl2br(e($post->body)) !!}</p>
@endsection
うわーーーーーーーーーーー 酒飲みてーーーーーーーーーーーーーーー
