Payroll::getTitleAttribute()   A
last analyzed

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\OpenPayroll\Models\Payroll;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\SoftDeletes;
7
8
class Payroll extends Model
9
{
10
    use SoftDeletes;
11
12
    protected $guarded = ['id'];
13
14
    protected $casts = [
15
        'date' => 'datetime:Y-m-d',
16
    ];
17
18
    public function getTitleAttribute()
19
    {
20
        return 'Payroll for ' . \Carbon\Carbon::parse($this->year . '-' . $this->month . '-1')->format('M') . ' ' . $this->year;
0 ignored issues
show
Bug introduced by
The property month does not seem to exist on CleaniqueCoders\OpenPayroll\Models\Payroll\Payroll. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
Bug introduced by
The property year does not seem to exist on CleaniqueCoders\OpenPayroll\Models\Payroll\Payroll. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
21
    }
22
23
    public function user()
24
    {
25
        return $this->belongsTo(config('open-payroll.models.user'));
26
    }
27
28
    public function payslips()
29
    {
30
        return $this->hasMany(config('open-payroll.models.payslip'));
31
    }
32
33
    public function status()
34
    {
35
        return $this->hasOne(config('open-payroll.models.payroll_status'));
36
    }
37
}
38