Skip to content

Commit 3242d46

Browse files
committed
feix:blog view company name
1 parent aa66ed6 commit 3242d46

File tree

2 files changed

+19
-27
lines changed

2 files changed

+19
-27
lines changed

resources/views/livewire/blog/listing.blade.php

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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>

resources/views/livewire/company/company-blog-manager.blade.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ class="btn btn-primary px-8 shadow-lg hover:shadow-primary/20 transition-all gap
232232
<tr class="bg-base-200/50 text-base-content">
233233
<th class="pl-6">Title</th>
234234
<th>Status</th>
235-
<th>Approval Status</th>
236235
<th>Submitted</th>
237236
<th class="text-right pr-6">Actions</th>
238237
</tr>
@@ -257,18 +256,6 @@ class="btn btn-primary px-8 shadow-lg hover:shadow-primary/20 transition-all gap
257256
<span class="badge badge-error">Archived</span>
258257
@endif
259258
</td>
260-
<td>
261-
@if($blog->is_approved)
262-
<div class="flex items-center gap-2">
263-
<span class="badge badge-success badge-sm">Approved</span>
264-
@if($blog->approved_at)
265-
<span class="text-xs opacity-60">{{ $blog->approved_at->format('M d') }}</span>
266-
@endif
267-
</div>
268-
@else
269-
<span class="badge badge-warning badge-sm">Pending Approval</span>
270-
@endif
271-
</td>
272259
<td>
273260
@if($blog->submitted_at)
274261
<div class="text-sm">{{ $blog->submitted_at->format('M d, Y') }}</div>
@@ -307,7 +294,7 @@ class="btn btn-error btn-ghost btn-sm" title="Delete">
307294
</tr>
308295
@empty
309296
<tr>
310-
<td colspan="5" class="text-center py-16 bg-base-50/50">
297+
<td colspan="4" class="text-center py-16 bg-base-50/50">
311298
<div
312299
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">
313300
<x-icon name="o-document-text" class="w-10 h-10 text-primary opacity-50" />

0 commit comments

Comments
 (0)