From e2e06760928519e0018b4c96f5902495034e7e04 Mon Sep 17 00:00:00 2001 From: farhantock Date: Fri, 19 Jan 2024 11:19:23 +0700 Subject: [PATCH 1/2] add new response appConfig --- app/Http/Controllers/AuthController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index 37ae48f..7ef300e 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Hash; use App\Models\User; use App\Models\Role; +use App\Models\Company; use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\Password; use Illuminate\Validation\ValidationException; @@ -58,6 +59,10 @@ class AuthController extends Controller $dataRole = Role::find($user->role_id); $dataHierarchy = $this->getDataHierarchy($user->divisi_id, $user->id); + $configApp = Company::where('id', $user->company_id)->first(); + + if ($configApp) + $user->configApp = $configApp; if ($dataRole) $user->role = $dataRole; From 136fb42da4e0276c4ae3547d15bd76c351107014 Mon Sep 17 00:00:00 2001 From: farhantock Date: Fri, 19 Jan 2024 11:19:34 +0700 Subject: [PATCH 2/2] add field company_id in models --- app/Models/Absent.php | 2 +- app/Models/Broadcast.php | 2 +- app/Models/Company.php | 3 ++- app/Models/PanicButton.php | 4 ++-- app/Models/Presence.php | 6 +++--- app/Models/ReportK3.php | 11 ++++++----- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/app/Models/Absent.php b/app/Models/Absent.php index c8af929..89aa095 100644 --- a/app/Models/Absent.php +++ b/app/Models/Absent.php @@ -12,6 +12,6 @@ class Absent extends Model const UPDATED_AT = 'updated_at'; protected $fillable = [ - 'user_id', 'description', 'created_at', 'created_by', 'updated_at', 'updated_by' + 'user_id', 'description', 'created_at', 'created_by', 'updated_at', 'updated_by', 'company_id' ]; } diff --git a/app/Models/Broadcast.php b/app/Models/Broadcast.php index bacbdcd..d1c7ed0 100644 --- a/app/Models/Broadcast.php +++ b/app/Models/Broadcast.php @@ -12,6 +12,6 @@ class Broadcast extends Model const UPDATED_AT = 'updated_at'; protected $fillable = [ - 'title_notif', 'message_notif', 'description', 'send_to_type', 'send_to_id', 'status_send', 'created_at', 'created_by', 'updated_at', 'updated_by' + 'title_notif', 'message_notif', 'description', 'send_to_type', 'send_to_id', 'status_send', 'created_at', 'created_by', 'updated_at', 'updated_by', 'company_id' ]; } diff --git a/app/Models/Company.php b/app/Models/Company.php index 2dc38e5..7593aed 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -31,6 +31,7 @@ class Company extends Model 'created_at', 'created_by', 'updated_at', - 'updated_by' + 'updated_by', + 'date_register' ]; } diff --git a/app/Models/PanicButton.php b/app/Models/PanicButton.php index 361bf79..51e1e2a 100644 --- a/app/Models/PanicButton.php +++ b/app/Models/PanicButton.php @@ -12,6 +12,6 @@ class PanicButton extends Model const UPDATED_AT = 'updated_at'; protected $fillable = [ - 'user_id', 'lat', 'lon', 'status_response', 'description', 'created_at', 'created_by', 'updated_at', 'updated_by' - ]; + 'user_id', 'lat', 'lon', 'status_response', 'description', 'created_at', 'created_by', 'updated_at', 'updated_by', 'company_id' + ]; } diff --git a/app/Models/Presence.php b/app/Models/Presence.php index 620a91e..e3fa1cd 100644 --- a/app/Models/Presence.php +++ b/app/Models/Presence.php @@ -13,9 +13,9 @@ class Presence extends Model const UPDATED_AT = 'updated_at'; protected $fillable = [ - 'user_id', 'clock_in', 'clock_out', 'date_presence', + 'user_id', 'clock_in', 'clock_out', 'date_presence', 'clock_in_lat', 'clock_in_lng', 'clock_out_lat', 'clock_out_lng', - 'clock_in_loc', 'clock_out_loc','clock_in_boundary', 'clock_out_boundary', - 'created_at', 'created_by', 'updated_at', 'updated_by' + 'clock_in_loc', 'clock_out_loc', 'clock_in_boundary', 'clock_out_boundary', + 'created_at', 'created_by', 'updated_at', 'updated_by', 'company_id' ]; } diff --git a/app/Models/ReportK3.php b/app/Models/ReportK3.php index a2cc852..abf36e3 100644 --- a/app/Models/ReportK3.php +++ b/app/Models/ReportK3.php @@ -12,14 +12,15 @@ class ReportK3 extends Model const UPDATED_AT = 'updated_at'; protected $fillable = [ - 'user_id', + 'user_id', 'description', 'proyek_id', 'report_date', 'description', - 'created_at', - 'created_by', - 'updated_at', - 'updated_by' + 'created_at', + 'created_by', + 'updated_at', + 'updated_by', + 'company_id' ]; }