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 \Illuminate\Database\Eloquent\Collection|\App\Models\Room[] $rooms |
23
|
|
|
* |
24
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Guest whereAddress($value) |
25
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Guest whereContact($value) |
26
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Guest whereCreatedAt($value) |
27
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Guest whereFirstName($value) |
28
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Guest whereId($value) |
29
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Guest whereLastName($value) |
30
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Guest wherePESEL($value) |
31
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Guest wherePlace($value) |
32
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Guest whereUpdatedAt($value) |
33
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Guest whereZipCode($value) |
34
|
|
|
* @mixin \Eloquent |
35
|
|
|
*/ |
36
|
|
|
class Guest extends Model |
37
|
|
|
{ |
38
|
|
|
protected $fillable = [ |
39
|
|
|
'first_name', 'last_name', 'address', 'zip_code', 'place', 'PESEL', 'contact', |
40
|
|
|
]; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Get the user's full name. |
44
|
|
|
* |
45
|
|
|
* @return string |
46
|
|
|
*/ |
47
|
21 |
|
public function getFullNameAttribute() |
48
|
|
|
{ |
49
|
21 |
|
return "{$this->first_name} {$this->last_name}"; |
50
|
|
|
} |
51
|
|
|
|
52
|
3 |
|
public function reservations() |
53
|
|
|
{ |
54
|
3 |
|
return $this->hasMany('App\Models\Reservation'); |
55
|
|
|
} |
56
|
|
|
|
57
|
2 |
|
public function rooms() |
58
|
|
|
{ |
59
|
2 |
|
return $this->belongsToMany('App\Models\Room', 'reservations'); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|