38 lines
650 B
PHP
38 lines
650 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
|
||
|
|
class ForumPost extends Model
|
||
|
|
{
|
||
|
|
protected $fillable = [
|
||
|
|
'topic_id',
|
||
|
|
'user_id',
|
||
|
|
'content',
|
||
|
|
'is_solution',
|
||
|
|
'edited_at',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'is_solution' => 'boolean',
|
||
|
|
'edited_at' => 'datetime',
|
||
|
|
];
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the topic that owns the post.
|
||
|
|
*/
|
||
|
|
public function topic()
|
||
|
|
{
|
||
|
|
return $this->belongsTo(ForumTopic::class, 'topic_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the user that owns the post.
|
||
|
|
*/
|
||
|
|
public function user()
|
||
|
|
{
|
||
|
|
return $this->belongsTo(User::class);
|
||
|
|
}
|
||
|
|
}
|