From aae4731b18c7bb44655044d623f1f8bd74e90f92 Mon Sep 17 00:00:00 2001 From: Seth Sharp Date: Sun, 5 May 2024 08:35:16 +1000 Subject: [PATCH] remove prop from component - use directly --- app/Http/Livewire/Blogs/ShowBlog.php | 5 +--- .../views/livewire/blogs/show-blog.blade.php | 30 +++++++++---------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/app/Http/Livewire/Blogs/ShowBlog.php b/app/Http/Livewire/Blogs/ShowBlog.php index d9bc833..b076d92 100644 --- a/app/Http/Livewire/Blogs/ShowBlog.php +++ b/app/Http/Livewire/Blogs/ShowBlog.php @@ -68,9 +68,6 @@ public function like(): void public function render(): View { - return view('livewire.blogs.show-blog', [ - 'blog' => $this->blog, - 'content' => $this->blog->getContent() - ]); + return view('livewire.blogs.show-blog'); } } diff --git a/resources/views/livewire/blogs/show-blog.blade.php b/resources/views/livewire/blogs/show-blog.blade.php index cc8b5c1..7403436 100644 --- a/resources/views/livewire/blogs/show-blog.blade.php +++ b/resources/views/livewire/blogs/show-blog.blade.php @@ -1,22 +1,22 @@ -@section('title', $blog?->meta_title ? $blog->meta_title : $blog->title) +@section('title', $this->blog?->meta_title ? $this->blog->meta_title : $this->blog->title) @push('meta') - @if($blog->meta_description) - + @if($this->blog->meta_description) + @endif - @if($blog->meta_tags) - + @if($this->blog->meta_tags) + @endif - @if (! $blog->is_published) + @if (! $this->blog->is_published) @endif @endpush
@role('admin', 'author') - + @endrole @@ -27,11 +27,11 @@ @endif -

{{ $blog->title }}

+

{{ $this->blog->title }}

- @if($blog->published_at) - {{ $blog->author->name }} {{ $blog->published_at_for_humans }} + @if($this->blog->published_at) + {{ $this->blog->author->name }} {{ $this->blog->published_at_for_humans }} @else This blog is in a draft status @endif @@ -39,7 +39,7 @@
- {!! $content !!} + {!! $this->blog->getContent() !!}
@@ -47,11 +47,11 @@
- @foreach($blog->tags as $tag) + @foreach($this->blog->tags as $tag) {{ $tag->name }} @@ -61,7 +61,7 @@ class="rounded-lg text-gray-700 h-fit border-[1px] bg-gray-100 text-sm px-2 py-1
- +
@@ -89,7 +89,7 @@ class="cursor-pointer rounded-lg border border-gray-300 transition hover:border- Next blog -
{{ $blog->title }}
+
{{ $this->blog->title }}
@endif