1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace CleaniqueCoders\OpenPayroll\Traits; |
4
|
|
|
|
5
|
|
|
use CleaniqueCoders\OpenPayroll\Models\Deduction\Type as DeductionType; |
6
|
|
|
use CleaniqueCoders\OpenPayroll\Models\Earning\Type as EarningType; |
7
|
|
|
use CleaniqueCoders\OpenPayroll\Models\Payroll\Status as PayrollStatus; |
8
|
|
|
use CleaniqueCoders\OpenPayroll\Models\Payslip\Status as PayslipStatus; |
9
|
|
|
use Illuminate\Support\Str; |
10
|
|
|
|
11
|
|
|
trait ReferenceTrait |
12
|
|
|
{ |
13
|
|
|
public function seedReferences() |
14
|
|
|
{ |
15
|
|
|
$this->seedPayrollStatuses(); |
16
|
|
|
$this->seedPayslipStatuses(); |
17
|
|
|
$this->seedEarningTypes(); |
18
|
|
|
$this->seedDeductionTypes(); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
private function seedPayrollStatuses() |
22
|
|
|
{ |
23
|
|
|
$data = config('open-payroll.seeds.payroll_statuses'); |
24
|
|
|
|
25
|
|
|
foreach ($data as $datum) { |
26
|
|
|
PayrollStatus::create([ |
27
|
|
|
'name' => $datum, |
28
|
|
|
'code' => Str::kebab($datum), |
29
|
|
|
'is_locked' => true, |
30
|
|
|
]); |
31
|
|
|
} |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
private function seedPayslipStatuses() |
35
|
|
|
{ |
36
|
|
|
$data = config('open-payroll.seeds.payslip_statuses'); |
37
|
|
|
|
38
|
|
|
foreach ($data as $datum) { |
39
|
|
|
PayslipStatus::create([ |
40
|
|
|
'name' => $datum, |
41
|
|
|
'code' => Str::kebab($datum), |
42
|
|
|
'is_locked' => true, |
43
|
|
|
]); |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
private function seedDeductionTypes() |
48
|
|
|
{ |
49
|
|
|
$data = config('open-payroll.seeds.deduction_types'); |
50
|
|
|
|
51
|
|
|
foreach ($data as $datum) { |
52
|
|
|
DeductionType::create([ |
53
|
|
|
'name' => $datum, |
54
|
|
|
'code' => Str::kebab($datum), |
55
|
|
|
'is_locked' => true, |
56
|
|
|
]); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
private function seedEarningTypes() |
61
|
|
|
{ |
62
|
|
|
$data = config('open-payroll.seeds.earning_types'); |
63
|
|
|
|
64
|
|
|
foreach ($data as $datum) { |
65
|
|
|
EarningType::create([ |
66
|
|
|
'name' => $datum, |
67
|
|
|
'code' => Str::kebab($datum), |
68
|
|
|
'is_locked' => true, |
69
|
|
|
]); |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|