Passed
Push — MODEL_LIB_240928 ( 9bf6d2...bd3167 )
by Rafael
49:03
created

AccountingJournal::bankAccounts()   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\Accountancy\Model;
20
21
use App\Models\BankAccount;
22
use Dolibarr\Core\Base\Model;
23
use Illuminate\Database\Eloquent\Collection;
24
25
/**
26
 * Class AccountingJournal
27
 *
28
 * @property int $rowid
29
 * @property int $entity
30
 * @property string $code
31
 * @property string $label
32
 * @property int $nature
33
 * @property int|null $active
34
 *
35
 * @property Collection|BankAccount[] $bank_accounts
36
 *
37
 * @package Dolibarr\Code\Accountancy\Model
38
 */
39
class AccountingJournal extends Model
40
{
41
    public $timestamps = false;
42
43
    protected $table = 'accounting_journal';
44
45
    protected $casts = [
46
        'entity' => 'int',
47
        'nature' => 'int',
48
        'active' => 'int'
49
    ];
50
51
    protected $fillable = [
52
        'entity',
53
        'code',
54
        'label',
55
        'nature',
56
        'active'
57
    ];
58
59
    public function bankAccounts()
60
    {
61
        return $this->hasMany(BankAccount::class, 'fk_accountancy_journal');
62
    }
63
}
64