git commit "feat: create database tables and relationships"
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Tour
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $title
|
||||
* @property string $summary
|
||||
* @property string $description
|
||||
* @property string $image
|
||||
* @property int $travel_type_id
|
||||
* @property float $price
|
||||
* @property Carbon $departure_date
|
||||
* @property int $status
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
* @property Collection|Comment[] $comments
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class Tour extends Model
|
||||
{
|
||||
protected $table = 'tours';
|
||||
|
||||
protected $casts = [
|
||||
'travel_type_id' => 'int',
|
||||
'price' => 'float',
|
||||
'departure_date' => 'datetime',
|
||||
'status' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'summary',
|
||||
'description',
|
||||
'image',
|
||||
'travel_type_id',
|
||||
'price',
|
||||
'departure_date',
|
||||
'status'
|
||||
];
|
||||
|
||||
public function comments()
|
||||
{
|
||||
return $this->hasMany(Comment::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user