Refactor News management features: replace author text input with a searchable select component in NewsResource, update NewsPageController to fetch news with authors and recent articles, and enhance the news show view to display author details and comments more effectively.

This commit is contained in:
nurmuhammet committed 2025-07-28 21:05:24 +05:00
1 parent 1b4989b440
commit 6b0c92d838
12 files changed
+360 -52

No files matched your search

+7 -1
View File
@@ -4,6 +4,7 @@
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class News extends Model
@@ -16,11 +17,16 @@ class News extends Model
'content',
'image',
'published_at',
'author',
'author_id',
];
public function comments(): HasMany
{
return $this->hasMany(Comment::class);
}
public function author(): BelongsTo
{
return $this->belongsTo(Author::class);
}
}