Implement news management features: add author field and comments functionality in NewsResource, enhance HomePageController to fetch latest news, and create dedicated views for news display and commenting. Update routes for comment submission and adjust homepage to showcase recent news articles.
This commit is contained in:
24
app/Models/Comment.php
Normal file
24
app/Models/Comment.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Comment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'message',
|
||||
'author_name',
|
||||
'news_id',
|
||||
];
|
||||
|
||||
public function news(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(News::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user