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

BookcalCalendar   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A user() 0 3 1
A bookcal_availabilities() 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
use Illuminate\Database\Eloquent\Collection;
25
26
/**
27
 * Class BookcalCalendar
28
 *
29
 * @property int $rowid
30
 * @property int $entity
31
 * @property string $ref
32
 * @property string|null $label
33
 * @property int|null $fk_soc
34
 * @property int|null $fk_project
35
 * @property string|null $description
36
 * @property string|null $note_public
37
 * @property string|null $note_private
38
 * @property Carbon $date_creation
39
 * @property Carbon|null $tms
40
 * @property int $fk_user_creat
41
 * @property int|null $fk_user_modif
42
 * @property string|null $import_key
43
 * @property int $status
44
 * @property int $type
45
 * @property int $visibility
46
 *
47
 * @property User $user
48
 * @property Collection|BookcalAvailability[] $bookcal_availabilities
49
 */
50
class BookcalCalendar extends Model
51
{
52
    public $timestamps = false;
53
    protected $table = 'bookcal_calendar';
54
    protected $casts = [
55
        'entity' => 'int',
56
        'fk_soc' => 'int',
57
        'fk_project' => 'int',
58
        'date_creation' => 'datetime',
59
        'tms' => 'datetime',
60
        'fk_user_creat' => 'int',
61
        'fk_user_modif' => 'int',
62
        'status' => 'int',
63
        'type' => 'int',
64
        'visibility' => 'int'
65
    ];
66
67
    protected $fillable = [
68
        'entity',
69
        'ref',
70
        'label',
71
        'fk_soc',
72
        'fk_project',
73
        'description',
74
        'note_public',
75
        'note_private',
76
        'date_creation',
77
        'tms',
78
        'fk_user_creat',
79
        'fk_user_modif',
80
        'import_key',
81
        'status',
82
        'type',
83
        'visibility'
84
    ];
85
86
    public function user()
87
    {
88
        return $this->belongsTo(User::class, 'fk_user_creat');
89
    }
90
91
    public function bookcal_availabilities()
92
    {
93
        return $this->hasMany(BookcalAvailability::class, 'fk_bookcal_calendar');
94
    }
95
}
96