Completed
Push — master ( 1f93a6...620046 )
by Nasrul Hazim
01:57
created

BankAccount::bankable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace CleaniqueCoders\Profile\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class BankAccount extends Model
8
{
9
    protected $guarded = ['id'];
10
11
    /**
12
     * [bank description].
13
     *
14
     * @return [type] [description]
0 ignored issues
show
Documentation Bug introduced by
The doc comment [type] at position 0 could not be parsed: Unknown type name '[' at position 0 in [type].
Loading history...
15
     */
16
    public function bank()
17
    {
18
        return $this->belongsTo(Bank::class)->withDefault();
19
    }
20
21
    /**
22
     * Get all of the owning bank models.
23
     */
24
    public function bankable()
25
    {
26
        return $this->morphTo();
27
    }
28
29
    /**
30
     * Get Bank Name via Accessor.
31
     *
32
     * @return string
33
     */
34
    public function getBankNameAttribute()
35
    {
36
        return $this->bank->name;
37
    }
38
}
39