select('*') ->get(); } public function getCategory($id) { // /api/rpc/store/category/getcategory/1 return DB::table('str_category') ->select('*') ->where('id', $id) ->get(); } public function getCategoryParent($id) { // /api/rpc/store/category/getcategoryparent/1 return DB::table('str_category') ->select('parent_id') ->where('id', $id) ->get(); } public function getCategoryMinScreenshots($id) { // /api/rpc/store/category/getcategoryminscrot/1 return DB::table('str_category') ->select('min_screenshots') ->where('id', $id) ->get(); } public function getCategoryName($id) { // /api/rpc/store/category/getcategoryname/id return DB::table('str_category') ->select('name') ->where('id', $id) ->get(); } // Entries public function getAllEntries() { // /api/rpc/store/entry/getallentries return DB::table('str_file') ->select('*') ->get(); } public function getAllApprovedEntries() { // /api/rpc/store/entry/getallapprovedentries return DB::table('str_file') ->select('*') ->where('isApproved', 1) ->get(); } public function getAllBrokenEntries() { // /api/rpc/store/entry/getallbrokenentries return DB::table('str_file') ->select('*') ->where('isBroken', 1) ->get(); } public function getAllPendingEntries() { // /api/rpc/store/entry/getallpendingentries return DB::table('str_file') ->select('*') ->where('isApproved', 0) ->get(); } public function getNewEntries() { // /api/rpc/store/entry/getnewentries return DB::table('str_file') ->select( 'id', 'title', 'version', 'submit_date' ) ->where('isApproved', 1) ->orderBy('submit_date', 'desc') ->limit(5) ->get(); } public function getHotEntries() { // /api/rpc/store/entry/gethotentries return DB::table('str_file') ->select( 'id', 'title', 'version', 'downloads' ) ->where('isApproved', 1) ->orderBy('downloads', 'desc') ->limit(5) ->get(); } public function getEntriesPageAll($cat, $from, $to) { // /api/rpc/store/entry/getentriespageall/cat/from/to return DB::table('str_file') ->select( 'id', 'title', 'version', 'description', 'submit_date', 'last_date', 'views', 'downloads' ) ->where('cat_id', $cat) ->offset($from) ->limit($to) ->get(); } public function getEntriesPageApproved($cat, $from, $to) { // /api/rpc/store/entry/getentriespageapproved/cat/from/to return DB::table('str_file') ->select( 'id', 'title', 'version', 'description', 'submit_date', 'last_date', 'views', 'downloads' ) ->where('cat_id', $cat) ->where('isApproved', 1) ->offset($from) ->limit($to) ->get(); } public function getEntriesPagePopularView($cat, $from, $to) { // /api/rpc/store/entry/getentriespagepopularview/cat/from/to return DB::table('str_file') ->select( 'id', 'title', 'version', 'description', 'submit_date', 'last_date', 'views', 'downloads' ) ->where('cat_id', $cat) ->where('views', '>', 1000) ->offset($from) ->limit($to) ->get(); } public function getEntriesPagePopularDownload($cat, $from, $to) { // /api/rpc/store/entry/getentriespagepopulardownload/cat/from/to return DB::table('str_file') ->select( 'id', 'title', 'version', 'description', 'submit_date', 'last_date', 'views', 'downloads' ) ->where('cat_id', $cat) ->where('downloads', '>', 1000) ->offset($from) ->limit($to) ->get(); } public function getEntry($id) { // /api/rpc/store/entry/getentry/id return DB::table('str_owners') ->join('str_file', 'str_owners.file_id', '=', 'str_file.id') ->join('users', 'str_owners.user_id', '=', 'users.id') ->join('usr_details', 'usr_details.user_id', '=', 'str_owners.user_id') ->join('usr_profile', 'usr_profile.user_id', '=', 'str_owners.user_id') ->join('usr_perm_id', 'usr_perm_id.user_id', '=', 'str_owners.user_id') ->where('file_id', $id) ->get(array( "file_id", "users.id", "cat_id", "title", "version", "description", "changelog", "views", "downloads", "submit_date", "last_date", "username", "avatar", "perm_id", "gender", "display_name", "name_style", )); } public function getEntryName($id) { // /api/rpc/store/entry/getfilename/id return DB::table('str_file') ->select('title') ->where('id', $id) ->get(); } public function getEntriesInCategory($cat_id) { // /api/rpc/store/entry/getentriesincategory/cat_id return DB::table('str_file') ->select('*') ->where('cat_id', $cat_id) ->get(); } public function countEntriesInCategory($cat_id) { // /api/rpc/store/entry/countentriesincategory/cat_id return DB::table('str_file') ->where('cat_id', $cat_id) ->where('isApproved', 1) ->count(); } public function countEntriesInCategoryFull($cat_id) { // /api/rpc/store/entry/countentriesincategoryfull/cat_id return DB::table('str_file') ->where('cat_id', $cat_id) ->count(); } public function insertEntry(Request $request) { // /api/rpc/store/entry/insert return; } public function updateEntry(Request $request) { // /api/rpc/store/entry/update return DB::table('str_file') ->where('id', $request->id) ->update([ 'cat_id' => $request->cat_id, 'title' => $request->title, 'version' => $request->version, 'description' => $request->description, 'changelog' => $request->changelog, 'warningnote' => $request->warningnote, 'last_date' => $request->last_date ]); } public function restoreEntry(Request $request) { // /api/rpc/store/entry/restore return DB::table('str_file') ->where('id', $request->id) ->update(['isApproved', 1]); } public function removeEntry(Request $request) { // /api/rpc/store/entry/remove return DB::table('str_file') ->where('id', $request->id) ->update(['isApproved', 0]); } }