@@ -22,7 +22,7 @@ public function updatingSelectedCategory()
2222 public function with (): array
2323 {
2424 // Build query for published blogs
25- $query = Blog:: published ()-> with (' author' );
25+ $query = Blog:: published ()-> with ([ ' author' , ' company ' ] );
2626
2727 // Apply search filter
2828 if (! empty ($this -> search )) {
@@ -65,10 +65,8 @@ public function with(): array
6565 {{-- Filter Chips --}}
6666 <div class =" flex gap-2 flex-wrap items-center" >
6767 @foreach ($categories as $category )
68- <button
69- wire:click =" $set('selectedCategory', '{{ $category } } ')"
70- class =" btn btn-sm {{ $selectedCategory === $category ? ' btn-primary' : ' btn-outline' } }"
71- >
68+ <button wire:click =" $set('selectedCategory', '{{ $category } } ')"
69+ class =" btn btn-sm {{ $selectedCategory === $category ? ' btn-primary' : ' btn-outline' } }" >
7270 {{ $category } }
7371 </button >
7472 @endforeach
@@ -78,14 +76,18 @@ class="btn btn-sm {{ $selectedCategory === $category ? 'btn-primary' : 'btn-outl
7876 {{-- Blog Grid --}}
7977 <div class =" grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 pt-4" >
8078 @forelse ($posts as $post )
81- <article class =" card bg-base-100 border border-base-300 shadow-sm hover:shadow-md hover:-translate-y-1 transition-all duration-300 cursor-pointer" >
79+ <article
80+ class =" card bg-base-100 border border-base-300 shadow-sm hover:shadow-md hover:-translate-y-1 transition-all duration-300 cursor-pointer" >
8281 {{-- Image --}}
8382 <figure class =" relative h-48 overflow-hidden" >
8483 <div class =" absolute inset-0 bg-base-300 animate-pulse" ></div >
8584 @if ($post -> featured_image )
86- <img src =" {{ asset (' storage/' . $post -> featured_image ) } }" alt =" {{ $post -> title } }" class =" w-full h-full object-cover transform group-hover:scale-105 transition-transform duration-500 relative z-10" loading =" lazy" />
85+ <img src =" {{ asset (' storage/' . $post -> featured_image ) } }" alt =" {{ $post -> title } }"
86+ class =" w-full h-full object-cover transform group-hover:scale-105 transition-transform duration-500 relative z-10"
87+ loading =" lazy" />
8788 @else
88- <div class =" w-full h-full bg-gradient-to-br from-primary/20 to-secondary/20 flex items-center justify-center relative z-10" >
89+ <div
90+ class =" w-full h-full bg-gradient-to-br from-primary/20 to-secondary/20 flex items-center justify-center relative z-10" >
8991 <x-icon name =" o-document-text" class =" w-16 h-16 text-base-content/20" />
9092 </div >
9193 @endif
@@ -94,7 +96,8 @@ class="btn btn-sm {{ $selectedCategory === $category ? 'btn-primary' : 'btn-outl
9496 {{-- Card Body --}}
9597 <div class =" card-body p-5 flex flex-col h-full" >
9698 <div class =" flex items-center gap-2 mb-2" >
97- <span class =" badge badge-primary badge-outline badge-sm font-bold uppercase" >{{ $post -> category } } </span >
99+ <span
100+ class =" badge badge-primary badge-outline badge-sm font-bold uppercase" >{{ $post -> category } } </span >
98101 </div >
99102
100103 <h3 class =" card-title text-lg leading-tight hover:text-primary transition-colors line-clamp-2" >
@@ -107,11 +110,12 @@ class="btn btn-sm {{ $selectedCategory === $category ? 'btn-primary' : 'btn-outl
107110
108111 <div class =" mt-auto pt-4 flex items-center justify-between border-t border-base-300" >
109112 <div class =" flex items-center gap-2 text-xs text-base-content/70" >
110- <span class =" font-medium text-base-content" >{{ $post -> author -> name ?? ' Anonymous ' } } </span >
113+ <span class =" font-medium text-base-content" >{{ $post -> getAuthorName () } } </span >
111114 <span >•</span >
112115 <span >{{ $post -> published_at -> format (' M d, Y' ) } } </span >
113116 </div >
114- <a href =" {{ route (' blog.show' , $post -> slug ) } }" wire:navigate class =" text-primary text-sm font-semibold flex items-center gap-1 hover:gap-2 transition-all" >
117+ <a href =" {{ route (' blog.show' , $post -> slug ) } }" wire:navigate
118+ class =" text-primary text-sm font-semibold flex items-center gap-1 hover:gap-2 transition-all" >
115119 Read More
116120 <x-icon name =" o-arrow-right" class =" w-4 h-4" />
117121 </a >
@@ -120,7 +124,8 @@ class="btn btn-sm {{ $selectedCategory === $category ? 'btn-primary' : 'btn-outl
120124 </article >
121125 @empty
122126 <div class =" col-span-full text-center py-16" >
123- <div class =" bg-base-200 w-20 h-20 rounded-full flex items-center justify-center mx-auto mb-4 border-4 border-base-100 shadow-sm" >
127+ <div
128+ class =" bg-base-200 w-20 h-20 rounded-full flex items-center justify-center mx-auto mb-4 border-4 border-base-100 shadow-sm" >
124129 <x-icon name =" o-document-text" class =" w-10 h-10 text-primary opacity-50" />
125130 </div >
126131 <h3 class =" font-bold text-xl mb-1" >No Articles Found</h3 >
@@ -141,4 +146,4 @@ class="btn btn-sm {{ $selectedCategory === $category ? 'btn-primary' : 'btn-outl
141146 {{ $posts -> links () } }
142147 </div >
143148 @endif
144- </div >
149+ </div >
0 commit comments