diff --git a/resources/views/components/post-layout.blade.php b/resources/views/components/post-layout.blade.php new file mode 100644 index 0000000..08afe72 --- /dev/null +++ b/resources/views/components/post-layout.blade.php @@ -0,0 +1,9 @@ + + + Feta + + + + {{ $slot }} +
+ diff --git a/resources/views/post.blade.php b/resources/views/post.blade.php new file mode 100644 index 0000000..da7529e --- /dev/null +++ b/resources/views/post.blade.php @@ -0,0 +1,19 @@ + +
+

{{ $post->title }}

+ +

+ By + {{ $post->author->name }} + in + {{ $post->category->name }} + +

+ +
+ {!! $post->body !!} +
+
+ + Go Back! + \ No newline at end of file diff --git a/resources/views/posts.blade.php b/resources/views/posts.blade.php new file mode 100644 index 0000000..92135cd --- /dev/null +++ b/resources/views/posts.blade.php @@ -0,0 +1,23 @@ + + @foreach ($posts as $post) + + @endforeach + \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 852b11f..be2858b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,5 +1,9 @@ Post::latest()->with(['category', 'author'])->get() + ]); +}); + +Route::get('posts/{post}', function ($id) { + return view('post', [ + 'post' => Post::findOrFail($id) + ]); +}); + +Route::get('categories/{category:slug}', function (Category $category) { + return view('posts', [ + 'posts' => $category->posts + ]); +}); + +Route::get('authors/{author:username}', function (User $author) { + return view('posts', [ + 'posts' => $author->posts + ]); }); Route::get('/dashboard', function () {