Files
kiarash-airline/app/Models/Comment.php
T

55 lines
881 B
PHP

<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class Comment
*
* @property int $id
* @property int|null $user_id
* @property string|null $guest_name
* @property int $commentable_id
* @property string $commentable_type
* @property string $body
* @property Carbon $created_at
* @property Carbon $updated_at
*
* @property User|null $user
*
* @package App\Models
*/
class Comment extends Model
{
protected $table = 'comments';
protected $casts = [
'user_id' => 'int',
'commentable_id' => 'int'
];
protected $fillable = [
'user_id',
'guest_name',
'commentable_id',
'commentable_type',
'body'
];
public function commentable()
{
return $this->morphTo();
}
public function user()
{
return $this->belongsTo(User::class);
}
}