Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Ep#15: Blade Layouts
  • Loading branch information
arifktk32 committed Dec 6, 2021
1 parent f8c394a commit 9c5474d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 35 deletions.
10 changes: 10 additions & 0 deletions resources/views/layout.blade.php
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>Blog</title>
<link href="/app.css" rel="stylesheet" />
</head>
<body>
@yield('content')
</body>
</html>
27 changes: 11 additions & 16 deletions resources/views/post.blade.php
@@ -1,17 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title>Blog</title>
<link href="/app.css" rel="stylesheet" />
</head>
<body>
<article>
<h1>{{ $post->title }}</h1>
@extends('layout')

<div>
{!! $post->body !!}
</div>
</article>
<a href="/">Go Back</a>
</body>
</html>
@section('content')
<article>
<h1>{{ $post->title }}</h1>

<div>
{!! $post->body !!}
</div>
</article>
<a href="/">Go Back</a>
@endsection
35 changes: 16 additions & 19 deletions resources/views/posts.blade.php
@@ -1,19 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<title>Blog</title>
<link href="/app.css" rel="stylesheet" />
</head>
<body>
@foreach($posts as $post)
<article>
<h1>
<a href="/posts/{{ $post->slug }}">
{{ $post->title }}
</a>
</h1>
<p>{{ $post->excerpt }}</p>
</article>
@endforeach
</body>
</html>
@extends('layout');

@section('content')

@foreach($posts as $post)
<article>
<h1>
<a href="/posts/{{ $post->slug }}">
{{ $post->title }}
</a>
</h1>
<p>{{ $post->excerpt }}</p>
</article>
@endforeach

@endsection

0 comments on commit 9c5474d

Please sign in to comment.