Browse Source

Merge pull request 'dev-wahyun' (#79) from dev-wahyun into staging

Reviewed-on: ibnu/generic-ospro-backend#79
pull/1/head
farhantock 7 months ago
parent
commit
2e0eb6c951
  1. 2
      app/Http/Controllers/CompanyController.php
  2. 7
      app/Http/Controllers/HumanResourceController.php

2
app/Http/Controllers/CompanyController.php

@ -17,7 +17,7 @@ class CompanyController extends Controller
'registration_no' => 'required',
'template_id' => 'required',
'is_active' => 'required',
'type_paket' => 'required|in:Free,Basic',
'type_paket' => 'required|in:Free,Basic,Enterprise',
'base_url' => 'required'
]);

7
app/Http/Controllers/HumanResourceController.php

@ -3,7 +3,6 @@
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Support\Str;
use App\Models\UserToProyek;
use Illuminate\Http\Request;
use App\Models\HumanResource;
@ -18,15 +17,15 @@ class HumanResourceController extends Controller
public function add(Request $request)
{
$this->validate($request, [
'role_id' => 'required',
'name' => 'required',
'ktp_number' => 'required|string|unique:m_users,ktp_number',
'employee_type' => 'required',
'company_id' => 'required',
'username' => 'unique:m_users,username'
'username' => 'unique:m_users,username',
]);
$data = $request->all();
!$request->is_customer ? $this->validate($request,['role_id'=>'required','divisi_id'=>'required']) : '';
if (isset($request->password) && $request->password != "") {
$data['password'] = md5($request->password);
@ -113,6 +112,8 @@ class HumanResourceController extends Controller
public function update(Request $request, $id)
{
!$request->is_customer ? $this->validate($request,['role_id'=>'required','divisi_id'=>'required']) : '';
if (!$id || (int) $id < 0 || $id == "") {
return response()->json(['status' => 'failed', 'message' => 'Id is required!', 'code' => 400], 400);
}

Loading…
Cancel
Save