1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Models; |
4
|
|
|
|
5
|
|
|
use Illuminate\Database\Eloquent\Model; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* App\Models\Guest. |
9
|
|
|
* |
10
|
|
|
* @property int $id |
11
|
|
|
* @property string $first_name |
12
|
|
|
* @property string $last_name |
13
|
|
|
* @property string $address |
14
|
|
|
* @property string $zip_code |
15
|
|
|
* @property string $place |
16
|
|
|
* @property string $PESEL |
17
|
|
|
* @property string|null $contact |
18
|
|
|
* @property \Illuminate\Support\Carbon $created_at |
19
|
|
|
* @property \Illuminate\Support\Carbon $updated_at |
20
|
|
|
* @property-read string $full_name |
21
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Reservation[] $reservations |
22
|
|
|
* @property-read int|null $reservations_count |
23
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Room[] $rooms |
24
|
|
|
* @property-read int|null $rooms_count |
25
|
|
|
* |
26
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Guest newModelQuery() |
27
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Guest newQuery() |
28
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Guest query() |
29
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Guest whereAddress($value) |
30
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Guest whereContact($value) |
31
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Guest whereCreatedAt($value) |
32
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Guest whereFirstName($value) |
33
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Guest whereId($value) |
34
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Guest whereLastName($value) |
35
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Guest wherePESEL($value) |
36
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Guest wherePlace($value) |
37
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Guest whereUpdatedAt($value) |
38
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Guest whereZipCode($value) |
39
|
|
|
* |
40
|
|
|
* @mixin \Eloquent |
41
|
|
|
*/ |
42
|
|
|
class Guest extends Model |
43
|
|
|
{ |
44
|
|
|
protected $fillable = [ |
45
|
|
|
'first_name', 'last_name', 'address', 'zip_code', 'place', 'PESEL', 'contact', |
46
|
|
|
]; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Get the user's full name. |
50
|
|
|
* |
51
|
|
|
* @return string |
52
|
|
|
*/ |
53
|
21 |
|
public function getFullNameAttribute() |
54
|
|
|
{ |
55
|
21 |
|
return "{$this->first_name} {$this->last_name}"; |
56
|
|
|
} |
57
|
|
|
|
58
|
3 |
|
public function reservations() |
59
|
|
|
{ |
60
|
3 |
|
return $this->hasMany('App\Models\Reservation'); |
61
|
|
|
} |
62
|
|
|
|
63
|
2 |
|
public function rooms() |
64
|
|
|
{ |
65
|
2 |
|
return $this->belongsToMany('App\Models\Room', 'reservations'); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|