New and edit game and category API calls.

このコミットが含まれているのは:
テクニカル諏訪子 2018-03-05 18:59:58 +09:00
コミット 21aeed6170
2個のファイルの変更41行の追加0行の削除

ファイルの表示

@ -21,6 +21,23 @@ class StoreController extends Controller {
->get();
}
public function newGame(Request $request) { // /api/rpc/store/games/newgame
$add = DB::table('str_game')
->insert([
'name' => $request->name
]);
return \Response::json($add);
}
public function editGame(Request $request) { // /api/rpc/store/games/editgame
return DB::table('str_game')
->where('id', $request->id)
->update([
'name' => $request->name
]);
}
// Category
public function getCategories() { // /api/rpc/store/category/getcategories
return DB::table('str_category')
@ -76,6 +93,26 @@ class StoreController extends Controller {
->get();
}
public function newCategory(Request $request) { // /api/rpc/store/category/newcategory
$add = DB::table('str_category')
->insert([
'name' => $request->name,
'game' => this.id,
'min_screenshots' => $request->min_screenshots
]);
return \Response::json($add);
}
public function editCategory(Request $request) { // /api/rpc/store/category/editcategory
return DB::table('str_category')
->where('id', $request->id)
->update([
'name' => $request->name,
'min_screenshots' => $request->min_screenshots
]);
}
// Entries
public function getAllEntries() { // /api/rpc/store/entry/getallentries
return DB::table('str_file')

ファイルの表示

@ -14,6 +14,8 @@
// Games
Route::get('/api/rpc/store/game/getgames', 'StoreController@getGames');
Route::get('/api/rpc/store/game/getgame/{id}', 'StoreController@getGame');
Route::post('/api/rpc/store/game/newgame', 'StoreController@newGame');
Route::post('/api/rpc/store/game/editgame', 'StoreController@editGame');
// Category
Route::get('/api/rpc/store/category/getcategories', 'StoreController@getCategories');
@ -23,6 +25,8 @@ Route::get('/api/rpc/store/category/getcategoriesofgame/{id}', 'StoreController@
Route::get('/api/rpc/store/category/getcategorygame/{id}', 'StoreController@getCategoryGame');
Route::get('/api/rpc/store/category/getcategoryminscrot/{id}', 'StoreController@getCategoryMinScreenshots');
Route::get('/api/rpc/store/category/getcategoryname/{id}', 'StoreController@getCategoryName');
Route::post('/api/rpc/store/category/newcategory', 'StoreController@newCategory');
Route::post('/api/rpc/store/category/editcategory', 'StoreController@editCategory');
// Entry
// Just to test middleware.