Files
exchange/routes/api.php
T
2018-04-27 18:03:16 +08:00

152 lines
4.7 KiB
PHP

<?php
use Illuminate\Http\Request;
Use App\Rate;
Use App\SettingBeneficiary;
Use App\SettingCredit;
Use App\SettingSupplier;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
Route::get('update-rate', 'RateController@index');
Route::get('update-rate/{rate}', 'RateController@show');
Route::post('update-rate', 'RateController@store');
Route::put('update-rate/{rate}', 'RateController@update');
Route::delete('update-rate/{rate}', 'RateController@delete');
Route::get('setting-beneficiary', 'SettingBeneficiaryController@index');
Route::get('setting-beneficiary/{beneficiary}', 'SettingBeneficiaryController@show');
Route::post('setting-beneficiary', 'SettingBeneficiaryController@store');
Route::put('setting-beneficiary/{beneficiary}', 'SettingBeneficiaryController@update');
Route::delete('setting-beneficiary/{beneficiary}', 'SettingBeneficiaryController@delete');
Route::get('setting-credit', 'SettingCreditController@index');
Route::get('setting-credit/{credit}', 'SettingCreditController@show');
Route::post('setting-credit', 'SettingCreditController@store');
Route::put('setting-credit/{credit}', 'SettingCreditController@update');
Route::delete('setting-credit/{credit}', 'SettingCreditController@delete');
Route::get('setting-supplier', 'SettingSupplierController@index');
Route::get('setting-supplier/{supplier}', 'SettingSupplierController@show');
Route::post('setting-supplier', 'SettingSupplierController@store');
Route::put('setting-supplier/{supplier}', 'SettingSupplierController@update');
Route::delete('setting-supplier/{supplier}', 'SettingSupplierController@delete');
/*
//FOR UPDATE RATE
Route::get('update-rate', function() {
// If the Content-Type and Accept headers are set to 'application/json',
// this will return a JSON structure. This will be cleaned up later.
return Rate::all();
});
Route::get('update-rate/{id}', function($id) {
return Rate::find($id);
});
Route::post('update-rate', function(Request $request) {
return Rate::create($request->all);
});
Route::put('update-rate/{id}', function(Request $request, $id) {
$rate = Rate::findOrFail($id);
$rate->update($request->all());
return $rate;
});
//FOR SETTING BENEFICIARY
Route::get('setting-beneficiary', function() {
// If the Content-Type and Accept headers are set to 'application/json',
// this will return a JSON structure. This will be cleaned up later.
return SettingBeneficiary::all();
});
Route::get('setting-beneficiary/{id}', function($id) {
return SettingBeneficiary::find($id);
});
Route::post('setting-beneficiary', function(Request $request) {
return SettingBeneficiary::create($request->all);
});
Route::put('setting-beneficiary/{id}', function(Request $request, $id) {
$beneficiary = SettingBeneficiary::findOrFail($id);
$beneficiary->update($request->all());
return $beneficiary;
});
Route::delete('setting-beneficiary/{id}', function($id) {
SettingBeneficiary::find($id)->delete();
return 204;
});
//FOR SETTING CREDIT
Route::get('setting-credit', function() {
// If the Content-Type and Accept headers are set to 'application/json',
// this will return a JSON structure. This will be cleaned up later.
return SettingCredit::all();
});
Route::get('setting-credit/{id}', function($id) {
return SettingCredit::find($id);
});
Route::post('setting-credit', function(Request $request) {
return SettingCredit::create($request->all);
});
Route::put('setting-credit/{id}', function(Request $request, $id) {
$credit = SettingCredit::findOrFail($id);
$credit->update($request->all());
return $credit;
});
//FOR SETTING SUPPLIER
Route::get('setting-supplier', function() {
// If the Content-Type and Accept headers are set to 'application/json',
// this will return a JSON structure. This will be cleaned up later.
return SettingSupplier::all();
});
Route::get('setting-supplier/{id}', function($id) {
return SettingSupplier::find($id);
});
Route::post('setting-supplier', function(Request $request) {
return SettingSupplier::create($request->all);
});
Route::put('setting-supplier/{id}', function(Request $request, $id) {
$supplier = SettingSupplier::findOrFail($id);
$supplier->update($request->all());
return $supplier;
});
Route::delete('setting-supplier/{id}', function($id) {
SettingSupplier::find($id)->delete();
return 204;
});
*/