Passed
Push — MODEL_LIB_240928 ( bd3167...74ce72 )
by Rafael
55:11
created

Adherent::categorie_members()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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\Adherents\Model;
20
21
use Carbon\Carbon;
22
use Dolibarr\Code\Categories\Model\CategorieMember;
23
use Dolibarr\Code\Societe\Model\Societe;
24
use Dolibarr\Core\Base\Model;
25
use Illuminate\Database\Eloquent\Collection;
26
27
/**
28
 * Class Adherent
29
 *
30
 * @property int $rowid
31
 * @property string $ref
32
 * @property int $entity
33
 * @property string|null $ref_ext
34
 * @property string|null $gender
35
 * @property string|null $civility
36
 * @property string|null $lastname
37
 * @property string|null $firstname
38
 * @property string|null $login
39
 * @property string|null $pass
40
 * @property string|null $pass_crypted
41
 * @property int $fk_adherent_type
42
 * @property string $morphy
43
 * @property string|null $societe
44
 * @property int|null $fk_soc
45
 * @property string|null $address
46
 * @property string|null $zip
47
 * @property string|null $town
48
 * @property int|null $state_id
49
 * @property int|null $country
50
 * @property string|null $email
51
 * @property string|null $url
52
 * @property string|null $socialnetworks
53
 * @property string|null $phone
54
 * @property string|null $phone_perso
55
 * @property string|null $phone_mobile
56
 * @property Carbon|null $birth
57
 * @property string|null $photo
58
 * @property int $statut
59
 * @property int $public
60
 * @property Carbon|null $datefin
61
 * @property string|null $default_lang
62
 * @property string|null $note_private
63
 * @property string|null $note_public
64
 * @property string|null $model_pdf
65
 * @property Carbon|null $datevalid
66
 * @property Carbon|null $datec
67
 * @property Carbon|null $tms
68
 * @property int|null $fk_user_author
69
 * @property int|null $fk_user_mod
70
 * @property int|null $fk_user_valid
71
 * @property string|null $canvas
72
 * @property string|null $ip
73
 * @property string|null $import_key
74
 *
75
 * @property AdherentType $adherent_type
76
 * @property Collection|CategorieMember[] $categorie_members
77
 */
78
class Adherent extends Model
79
{
80
    public $timestamps = false;
81
    protected $table = 'adherent';
82
    protected $casts = [
83
        'entity' => 'int',
84
        'fk_adherent_type' => 'int',
85
        'fk_soc' => 'int',
86
        'state_id' => 'int',
87
        'country' => 'int',
88
        'birth' => 'datetime',
89
        'statut' => 'int',
90
        'public' => 'int',
91
        'datefin' => 'datetime',
92
        'datevalid' => 'datetime',
93
        'datec' => 'datetime',
94
        'tms' => 'datetime',
95
        'fk_user_author' => 'int',
96
        'fk_user_mod' => 'int',
97
        'fk_user_valid' => 'int'
98
    ];
99
100
    protected $fillable = [
101
        'ref',
102
        'entity',
103
        'ref_ext',
104
        'gender',
105
        'civility',
106
        'lastname',
107
        'firstname',
108
        'login',
109
        'pass',
110
        'pass_crypted',
111
        'fk_adherent_type',
112
        'morphy',
113
        'societe',
114
        'fk_soc',
115
        'address',
116
        'zip',
117
        'town',
118
        'state_id',
119
        'country',
120
        'email',
121
        'url',
122
        'socialnetworks',
123
        'phone',
124
        'phone_perso',
125
        'phone_mobile',
126
        'birth',
127
        'photo',
128
        'statut',
129
        'public',
130
        'datefin',
131
        'default_lang',
132
        'note_private',
133
        'note_public',
134
        'model_pdf',
135
        'datevalid',
136
        'datec',
137
        'tms',
138
        'fk_user_author',
139
        'fk_user_mod',
140
        'fk_user_valid',
141
        'canvas',
142
        'ip',
143
        'import_key'
144
    ];
145
146
    public function societe()
147
    {
148
        return $this->belongsTo(Societe::class, 'fk_soc');
149
    }
150
151
    public function adherent_type()
152
    {
153
        return $this->belongsTo(AdherentType::class, 'fk_adherent_type');
154
    }
155
156
    public function categorie_members()
157
    {
158
        return $this->hasMany(CategorieMember::class, 'fk_member');
159
    }
160
}
161