Passed
Push — MODEL_LIB_240928 ( 74ce72...807d7f )
by Rafael
49:53
created

BookcalAvailability   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 36
c 1
b 0
f 0
dl 0
loc 47
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bookcal_calendar() 0 3 1
A user() 0 3 1
1
<?php
2
3
/* Copyright (C) 2024       Rafael San José         <[email protected]>
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 3 of the License, or
8
 * any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17
 */
18
19
namespace Dolibarr\Code\BookCal\Model;
20
21
use Carbon\Carbon;
22
use Dolibarr\Code\UserGroup\Model\User;
23
use Dolibarr\Core\Base\Model;
24
25
/**
26
 * Class BookcalAvailability
27
 *
28
 * @property int $rowid
29
 * @property string|null $label
30
 * @property string|null $description
31
 * @property string|null $note_public
32
 * @property string|null $note_private
33
 * @property Carbon $date_creation
34
 * @property Carbon|null $tms
35
 * @property int $fk_user_creat
36
 * @property int|null $fk_user_modif
37
 * @property string|null $last_main_doc
38
 * @property string|null $import_key
39
 * @property string|null $model_pdf
40
 * @property int $status
41
 * @property Carbon $start
42
 * @property Carbon $end
43
 * @property int $duration
44
 * @property int $startHour
45
 * @property int $endHour
46
 * @property int $fk_bookcal_calendar
47
 *
48
 * @property BookcalCalendar $bookcal_calendar
49
 * @property User $user
50
 */
51
class BookcalAvailability extends Model
52
{
53
    public $timestamps = false;
54
    protected $table = 'bookcal_availabilities';
55
    protected $casts = [
56
        'date_creation' => 'datetime',
57
        'tms' => 'datetime',
58
        'fk_user_creat' => 'int',
59
        'fk_user_modif' => 'int',
60
        'status' => 'int',
61
        'start' => 'datetime',
62
        'end' => 'datetime',
63
        'duration' => 'int',
64
        'startHour' => 'int',
65
        'endHour' => 'int',
66
        'fk_bookcal_calendar' => 'int'
67
    ];
68
69
    protected $fillable = [
70
        'label',
71
        'description',
72
        'note_public',
73
        'note_private',
74
        'date_creation',
75
        'tms',
76
        'fk_user_creat',
77
        'fk_user_modif',
78
        'last_main_doc',
79
        'import_key',
80
        'model_pdf',
81
        'status',
82
        'start',
83
        'end',
84
        'duration',
85
        'startHour',
86
        'endHour',
87
        'fk_bookcal_calendar'
88
    ];
89
90
    public function bookcal_calendar()
91
    {
92
        return $this->belongsTo(BookcalCalendar::class, 'fk_bookcal_calendar');
93
    }
94
95
    public function user()
96
    {
97
        return $this->belongsTo(User::class, 'fk_user_creat');
98
    }
99
}
100