21 lines
357 B
PHP
21 lines
357 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Comment extends Model
|
|
{
|
|
protected $fillable = ['user_id', 'content', 'commentable_id', 'commentable_type'];
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function commentable()
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
}
|