From 90e51a829d83ef7419133785352086a5fab773ce Mon Sep 17 00:00:00 2001 From: wahyun Date: Tue, 6 Feb 2024 12:53:07 +0700 Subject: [PATCH] product transaction --- .../ProductTransactionController.php | 30 +++++++++++++++++++ app/Models/ProductTransaction.php | 25 ++++++++++++++++ routes/web.php | 1 + 3 files changed, 56 insertions(+) create mode 100644 app/Http/Controllers/ProductTransactionController.php create mode 100644 app/Models/ProductTransaction.php diff --git a/app/Http/Controllers/ProductTransactionController.php b/app/Http/Controllers/ProductTransactionController.php new file mode 100644 index 0000000..c5d7a12 --- /dev/null +++ b/app/Http/Controllers/ProductTransactionController.php @@ -0,0 +1,30 @@ +validate($request, [ + 'company_id' => 'required|integer', + 'type_paket' => 'required|string', + 'amount' => 'required', + 'exp_ospro' => 'required' + ]); + + $data = $request->all(); + + $data['created_by'] = $this->currentName; + $result = ProductTransaction::create($data); + + if ($result) { + return response()->json(['status' => 'success','data' => $result, 'message' => 'Add Transaction successfully!', 'code' => 200], 200); + } else { + return response()->json(['status' => 'failed', 'message' => 'Add data Transaction failed!', 'code' => 400], 400); + } + } +} diff --git a/app/Models/ProductTransaction.php b/app/Models/ProductTransaction.php new file mode 100644 index 0000000..c4a59e5 --- /dev/null +++ b/app/Models/ProductTransaction.php @@ -0,0 +1,25 @@ +group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro // Landing Route $router->post('/send-email', 'AuthController@sendEmail'); $router->post('/company-management-user/add', 'CompanyController@add'); + $router->post('/product-transaction/add','ProductTransactionController@add'); $router->post('/company-management-user/search', 'CompanyController@search'); $router->post('/human-resource-user/add', 'HumanResourceController@add_user'); $router->get('/company-management-user/edit/{id}', 'CompanyController@edit');