Added About Page
This commit is contained in:
@@ -15,9 +15,15 @@ class Tour extends Model
|
||||
return $this->belongsToMany(Country::class, 'tour_countries', 'tour_id', 'country_id');
|
||||
}
|
||||
|
||||
public function tour_days()
|
||||
{
|
||||
return $this->hasMany(TourDay::class);
|
||||
}
|
||||
|
||||
public static function featuredTours(){
|
||||
return Tour::whereHas('countries.continent')
|
||||
->with('countries.continent')
|
||||
->with('tour_days')
|
||||
->inRandomOrder()
|
||||
->limit(4)
|
||||
->get();
|
||||
|
||||
26
app/Models/TourDay.php
Normal file
26
app/Models/TourDay.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TourDay extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tour_days';
|
||||
|
||||
protected $fillable = [
|
||||
'tour_id',
|
||||
'description',
|
||||
'content',
|
||||
'image',
|
||||
];
|
||||
|
||||
// Relationships
|
||||
public function tour(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Tour::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user