diff --git a/app/HargaEmas.php b/app/HargaEmas.php new file mode 100644 index 0000000..af4cef0 --- /dev/null +++ b/app/HargaEmas.php @@ -0,0 +1,26 @@ +json(Customer::on('mysql2')->find($id)); } - public function showOneCustomerByIC(Request $request){ + public function showOneCustomerByIC($ic){ $customer = Customer::on('mysql2') - ->where('kplama','=',$request->KpLama) - ->orWhere('kpbaru','=',$request->KpBaru) + ->where('kplama','=',$ic) + ->orWhere('kpbaru','=',$ic) ->first(); return response()->json($customer); @@ -55,6 +55,9 @@ class CustomerController extends Controller public function create(Request $request) { + $this->validate($request, [ + + ]); $customer = Customer::create($request->all()); return response()->json($customer, 201); diff --git a/app/Http/Controllers/HargaEmasController.php b/app/Http/Controllers/HargaEmasController.php new file mode 100644 index 0000000..0d09eeb --- /dev/null +++ b/app/Http/Controllers/HargaEmasController.php @@ -0,0 +1,22 @@ +json(HargaEmas::all()); + } + + public function update($id, Request $request) + { + $harga_emas = HargaEmas::findOrFail($id); + $harga_emas->update($request->all()); + + return response()->json($harga_emas, 200); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/MarhunController.php b/app/Http/Controllers/MarhunController.php new file mode 100644 index 0000000..06ad97b --- /dev/null +++ b/app/Http/Controllers/MarhunController.php @@ -0,0 +1,42 @@ +json(Marhun::all()); + } + + public function showOneMarhun($id) + { + $marhun = Marhun::where('noRujukan','=',$norujukan)->get(); + return response()->json($marhun); + } + + public function create(Request $request) + { + $marhun = Marhun::create($request->all()); + + return response()->json($marhun, 201); + } + + public function update($id, Request $request) + { + $marhun = Marhun::findOrFail($id); + $marhun->update($request->all()); + + return response()->json($marhun, 200); + } + + public function delete($id) + { + Marhun::findOrFail($id)->delete(); + return response('Deleted Successfully', 200); + } +} \ No newline at end of file diff --git a/app/Marhun.php b/app/Marhun.php new file mode 100644 index 0000000..c701253 --- /dev/null +++ b/app/Marhun.php @@ -0,0 +1,26 @@ +=5.5" + }, + "require-dev": { + "symfony/phpunit-bridge": "^4.4 || ^5.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2020-09-30T07:37:28+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3", + "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2020-09-30T07:37:11+00:00" + }, { "name": "illuminate/auth", "version": "v7.28.4", @@ -1595,6 +1847,61 @@ ], "time": "2020-09-15T14:53:08+00:00" }, + { + "name": "lcobucci/jwt", + "version": "3.3.3", + "source": { + "type": "git", + "url": "https://github.com/lcobucci/jwt.git", + "reference": "c1123697f6a2ec29162b82f170dd4a491f524773" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lcobucci/jwt/zipball/c1123697f6a2ec29162b82f170dd4a491f524773", + "reference": "c1123697f6a2ec29162b82f170dd4a491f524773", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "ext-openssl": "*", + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "mikey179/vfsstream": "~1.5", + "phpmd/phpmd": "~2.2", + "phpunit/php-invoker": "~1.1", + "phpunit/phpunit": "^5.7 || ^7.3", + "squizlabs/php_codesniffer": "~2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Lcobucci\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Luís Otávio Cobucci Oblonczyk", + "email": "lcobucci@gmail.com", + "role": "Developer" + } + ], + "description": "A simple library to work with JSON Web Token and JSON Web Signature", + "keywords": [ + "JWS", + "jwt" + ], + "time": "2020-08-20T13:22:28+00:00" + }, { "name": "monolog/monolog", "version": "2.1.1", @@ -2057,6 +2364,105 @@ ], "time": "2019-01-08T18:20:26+00:00" }, + { + "name": "psr/http-client", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "time": "2020-06-29T06:28:15+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + }, { "name": "psr/log", "version": "1.1.3", @@ -2152,6 +2558,46 @@ ], "time": "2017-10-23T01:57:42+00:00" }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2019-03-08T08:55:37+00:00" + }, { "name": "ramsey/collection", "version": "1.1.1", diff --git a/routes/web.php b/routes/web.php index 8eb4a6a..d967e0d 100644 --- a/routes/web.php +++ b/routes/web.php @@ -39,4 +39,14 @@ $router->group(['prefix'=>'api'], function () use ($router){ $router->post('lelong',['uses'=>'LelongController@create']); $router->delete('lelong/{id}', ['uses' => 'LelongController@delete']); $router->put('lelong/{id}', ['uses' => 'LelongController@update']); + + //Marhun API + $router->get('marhun',['uses'=>'MarhunController@showAllMarhuns']); + $router->get('marhun/{norujukan}',['uses'=>'MarhunController@showOneLelong']); + $router->post('marhun',['uses'=>'MarhunController@create']); + $router->put('marhun/{id}', ['uses' => 'MarhunController@update']); + + //Harga Emas API + $router->get('harga_emas',['uses'=>'HargaEmasController@showAllHargaEmas']); + $router->put('harga_emas',['uses'=>'HargaEmasController@update']); }); \ No newline at end of file