Human Resources
- Departments (name, description)
- Employees (user_id, depart_id, address, place of birth, dob, religion, sex, phone, salary, photo
- Payroll (user_id, salary)
- Leave (user_id, description, start_of_date, end_of_date, status [pending, approved, rejected])
- Attendances (user_id, status [present, absent, ...])
migration => struktur tabel pada database
seeder => data/isi pada tabel (opsional) / data dummy
php artisan route:list // melihat daftar rute
User Managements
- Roles
- Users
// Tahapan ambil project laravel dari github
git clone https://github.com/users/repo.git
composer install
php artisan generate:key
cp .env.example .env
sesuaikan isi pada file .env
php artisan migrate --seed
// simpan ke kedua tabel sekaligus
Model:
- Employee
public function user() {
return $this->belongsTo(User::class);
}
- User
public function employee() {
return $this->hasOne(Employee::class);
}
Controller:
- EmployeeController
// simpan ke tabel user
$user = User::create([
'name' => '',
'email' => '',
'password' => ''
]);
// simpan ke tabel employee
$user->employee->create([
'address' => '',
'place_of_birth' => '',
'dob' => '',
]);