FEATURE: move blog module into own repository
This commit is contained in:
Executable
+15
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace Modules\Blog\Article\Entities;
|
||||
|
||||
use App\Models\Content\Content;
|
||||
|
||||
class Article extends Content
|
||||
{
|
||||
protected $table = 'contents';
|
||||
|
||||
public function comments()
|
||||
{
|
||||
return $this->hasMany(Comment::class, 'content_id')
|
||||
->where('approved', true);
|
||||
}
|
||||
}
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
<?php namespace Modules\Blog\Article\Entities;
|
||||
|
||||
use App\Models\Content\Content;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Comment extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'content_id',
|
||||
'content',
|
||||
'email',
|
||||
'name',
|
||||
'approved'
|
||||
];
|
||||
|
||||
public function author()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
public function article()
|
||||
{
|
||||
return $this->belongsTo(Content::class, 'content_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user