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