1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* rmarchiv.tk |
5
|
|
|
* (c) 2016-2017 by Marcel 'ryg' Hering |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace App\Models; |
9
|
|
|
|
10
|
|
|
use Illuminate\Database\Eloquent\Model; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Class Event. |
14
|
|
|
* |
15
|
|
|
* @property int $id |
16
|
|
|
* @property int $user_id |
17
|
|
|
* @property string $start_date |
18
|
|
|
* @property string $end_date |
19
|
|
|
* @property string $title |
20
|
|
|
* @property string $description |
21
|
|
|
* @property int $slots |
22
|
|
|
* @property string $reg_start_date |
23
|
|
|
* @property string $reg_end_date |
24
|
|
|
* @property int $reg_allowed |
25
|
|
|
* @property \Carbon\Carbon $created_at |
26
|
|
|
* @property \Carbon\Carbon $updated_at |
27
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\Event whereId($value) |
28
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\Event whereUserId($value) |
29
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\Event whereStartDate($value) |
30
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\Event whereEndDate($value) |
31
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\Event whereTitle($value) |
32
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\Event whereDescription($value) |
33
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\Event whereSlots($value) |
34
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\Event whereRegStartDate($value) |
35
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\Event whereRegEndDate($value) |
36
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\Event whereRegAllowed($value) |
37
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\Event whereCreatedAt($value) |
38
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\Event whereUpdatedAt($value) |
39
|
|
|
* @mixin \Eloquent |
40
|
|
|
* @property-read \App\Models\User $user |
41
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\EventSetting[] $settings |
42
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\EventMeeting[] $meetings |
43
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\EventUserRegistered[] $users_registered |
44
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\EventPicture[] $pictures |
45
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Comment[] $comments |
46
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Venturecraft\Revisionable\Revision[] $revisionHistory |
47
|
|
|
*/ |
48
|
|
|
class Event extends Model |
49
|
|
|
{ |
50
|
|
|
use \Venturecraft\Revisionable\RevisionableTrait; |
51
|
|
|
protected $table = 'events'; |
52
|
|
|
|
53
|
|
|
public $timestamps = true; |
54
|
|
|
|
55
|
|
|
protected $fillable = [ |
56
|
|
|
'user_id', |
57
|
|
|
'start_date', |
58
|
|
|
'end_date', |
59
|
|
|
'title', |
60
|
|
|
'description', |
61
|
|
|
'slots', |
62
|
|
|
'reg_start_date', |
63
|
|
|
'reg_end_date', |
64
|
|
|
'reg_allowed', |
65
|
|
|
]; |
66
|
|
|
|
67
|
|
|
protected $guarded = []; |
68
|
|
|
|
69
|
|
|
public function user() |
70
|
|
|
{ |
71
|
|
|
return $this->hasOne('App\Models\User', 'id', 'user_id'); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function settings() |
75
|
|
|
{ |
76
|
|
|
return $this->hasOne('App\Models\EventSetting', 'event_id', 'id'); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function meetings() |
80
|
|
|
{ |
81
|
|
|
return $this->hasMany('App\Models\EventMeeting', 'event_id', 'id'); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function users_registered() |
85
|
|
|
{ |
86
|
|
|
return $this->hasMany('App\Models\EventUserRegistered', 'event_id', 'id'); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function pictures() |
90
|
|
|
{ |
91
|
|
|
return $this->hasMany('App\Models\EventPicture', 'event_id', 'id'); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public function comments() |
|
|
|
|
95
|
|
|
{ |
96
|
|
|
return $this->hasMany('App\Models\Comment', 'content_id', 'id')->Where('content_type', '=', \DB::raw("'event'"))->with('user'); |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.