1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Models; |
4
|
|
|
|
5
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory; |
6
|
|
|
use Illuminate\Database\Eloquent\Model; |
7
|
|
|
|
8
|
|
|
class Country extends Model |
9
|
|
|
{ |
10
|
|
|
use HasFactory; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* The attributes that aren't mass assignable. |
14
|
|
|
* |
15
|
|
|
* @var array |
16
|
|
|
*/ |
17
|
|
|
protected $guarded = []; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Returns the continent of the event. |
21
|
|
|
*/ |
22
|
|
|
public function continent() |
23
|
|
|
{ |
24
|
|
|
return $this->belongsTo(Continent::class); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Return the regions in this country |
29
|
|
|
* |
30
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany |
31
|
|
|
*/ |
32
|
|
|
public function regions() |
33
|
|
|
{ |
34
|
|
|
return $this->hasMany(Region::class); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Return the teachers based in this country |
39
|
|
|
* |
40
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany |
41
|
|
|
*/ |
42
|
|
|
public function teachers() |
43
|
|
|
{ |
44
|
|
|
return $this->hasMany(Teacher::class); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Return the organizers based in this country |
49
|
|
|
* |
50
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany |
51
|
|
|
*/ |
52
|
|
|
public function organizers() |
53
|
|
|
{ |
54
|
|
|
return $this->hasMany(Organizer::class); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Return the venues in this country |
59
|
|
|
* |
60
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany |
61
|
|
|
*/ |
62
|
|
|
public function venues() |
63
|
|
|
{ |
64
|
|
|
return $this->hasMany(Venue::class); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Return all the events in this country |
69
|
|
|
* |
70
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough |
71
|
|
|
*/ |
72
|
|
|
public function events() |
73
|
|
|
{ |
74
|
|
|
return $this->hasManyThrough('Event', 'Venue'); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Return all the events in this country |
79
|
|
|
* |
80
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany |
81
|
|
|
*/ |
82
|
|
|
public function testimonials() |
83
|
|
|
{ |
84
|
|
|
return $this->hasMany(Testimonial::class); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
} |
88
|
|
|
|