Files

69 lines
1.3 KiB
PHP

<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use App\Enums\CommentStatus;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class Comment
*
* @property int $id
* @property int|null $user_id
* @property int|null $flight_id
* @property int|null $tour_id
* @property string|null $guest_name
* @property string|null $guest_email
* @property string $comment
* @property int $status
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @property User|null $user
* @property Flight|null $flight
* @property Tour|null $tour
*
* @package App\Models
*/
class Comment extends Model
{
protected $table = 'comments';
protected $casts = [
'user_id' => 'int',
'flight_id' => 'int',
'tour_id' => 'int',
'status' => CommentStatus::class,
];
protected $fillable = [
'user_id',
'flight_id',
'tour_id',
'guest_name',
'guest_email',
'comment',
'status',
];
public function user()
{
return $this->belongsTo(User::class);
}
public function flight()
{
return $this->belongsTo(Flight::class, 'flight_id');
}
public function tour()
{
return $this->belongsTo(Tour::class, 'tour_id');
}
}