diff --git a/app/Models/NewTvRequest.php b/app/Models/NewTvRequest.php index 0e30957..3422543 100644 --- a/app/Models/NewTvRequest.php +++ b/app/Models/NewTvRequest.php @@ -174,11 +174,14 @@ class NewTvRequest extends Model { $newTvReq->activated_at = now(); $newTvReq->tv_fk = $tv->id; $newTvReq->save(); - - // try to sys_to_sys with indokargo - $jsonResponse = Indokargo::createTVAddress($tvRequest, $tv->id); DB::commit(); - return $jsonResponse; + return JSONResponse::Success(['message'=>'Success to update tv data']); + + // TODO: waiting execution until update from ops + // // try to sys_to_sys with indokargo + // DB::commit(); + // $jsonResponse = Indokargo::createTVAddress($tvRequest, $tv->id); + // return $jsonResponse; } catch(\Throwable $th) { DB::rollback(); throw $th; diff --git a/app/Models/Tv.php b/app/Models/Tv.php index f7824c8..bd07db1 100644 --- a/app/Models/Tv.php +++ b/app/Models/Tv.php @@ -45,29 +45,6 @@ class Tv extends Model { //------------------------------------------------------------ // -- RELATED TO REQUEST - public static function modifyAndValidateUpsertRequest(Request $request, $isUpdate = false) { - if($request->code) $request->merge(['code' => strtoupper($request->code)]); - $validationRules = [ - 'code' => ['required','string',Rule::unique('tvs', 'code') - ->when($request->id, function($q, $id) { - $q->whereNot('id', $id); - })], - 'col1' => 'nullable|string', - 'col2' => 'nullable|string', - 'col3' => 'nullable|string', - 'col4' => 'nullable|string', - 'col5' => 'nullable|string', - 'col6' => 'nullable|string', - 'col7' => 'nullable|string', - 'col8' => 'nullable|string', - 'col9' => 'nullable|string', - 'col10' => 'nullable|string', - 'notes' => 'nullable|string', - ]; - if($isUpdate) $validationRules['id'] = 'nullable|integer|exists:App\Models\Tv'; - $request->validate(); - return $request; - } public static function updateFromRequest(Request $request) { if($request->code) $request->merge(['code' => strtoupper($request->code)]); $request->validate([ @@ -106,10 +83,13 @@ class Tv extends Model { $tv->notes = $request->notes; $tv->update(); - // try to sys_to_sys with indokargo - $jsonResponse = Indokargo::updateTVAddress($request, $tv->id, $tv->ik_address_id); - DB::commit(); - return $jsonResponse; + return JSONResponse::Success(['message'=>'Success to update tv data']); + + // TODO: waiting from ops workflow + // // try to sys_to_sys with indokargo + // $jsonResponse = Indokargo::updateTVAddress($request, $tv->id, $tv->ik_address_id); + // DB::commit(); + // return $jsonResponse; } catch(\Throwable $th) { DB::rollback(); throw $th; @@ -123,12 +103,14 @@ class Tv extends Model { $tv = Tv::findOrFail($request->id); $tv->is_active = !$tv->is_active; $tv->save(); + return JSONResponse::Success(['message'=>'Success to change tv status']); - // try to sys_to_sys with indokargo - $jsonResponse = Indokargo::changeStatusAddress(new Request(['is_active' => $tv->is_active]), - $tv->id, $tv->ik_address_id); - DB::commit(); - return $jsonResponse; + // TODO: waiting from ops workflow + // // try to sys_to_sys with indokargo + // $jsonResponse = Indokargo::changeStatusAddress(new Request(['is_active' => $tv->is_active]), + // $tv->id, $tv->ik_address_id); + // DB::commit(); + // return $jsonResponse; } catch(\Throwable $th) { DB::rollback(); throw $th;