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
|
|||
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 |
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.