select('*') ->get(); } public function getAllApprovedFiles() { // /api/rpc/store/file/getallapprovedfiles return DB::table('str_file') ->select('*') ->where('isApproved', 1) ->get(); } public function getAllBrokenFiles() { // /api/rpc/store/file/getallbrokenfiles return DB::table('str_file') ->select('*') ->where('isBroken', 1) ->get(); } public function getAllPendingFiles() { // /api/rpc/store/file/getallpendingfiles return DB::table('str_file') ->select('*') ->where('isApproved', 0) ->get(); } public function getNewFiles() { // /api/rpc/store/file/getnewfiles return DB::table('str_file') ->select( 'id', 'title', 'version', 'submit_date' ) ->where('isApproved', 1) ->orderBy('submit_date', 'desc') ->limit(5) ->get(); } public function getHotFiles() { // /api/rpc/store/file/gethotfiles return DB::table('str_file') ->select( 'id', 'title', 'version', 'downloads' ) ->where('isApproved', 1) ->orderBy('downloads', 'desc') ->limit(5) ->get(); } public function getFilesPageAll($cat, $from, $to) { // /api/rpc/store/file/getfilespageall/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 getFilesPageApproved($cat, $from, $to) { // /api/rpc/store/file/getfilespageapproved/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 getFilesPagePopularView($cat, $from, $to) { // /api/rpc/store/file/getfilespagepopularview/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 getFilesPagePopularDownload($cat, $from, $to) { // /api/rpc/store/file/getfilespagepopulardownload/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 getFile($id) { // /api/rpc/store/file/getfile/id return DB::table('str_owners') ->join('str_file', 'str_owners.file_id', '=', 'str_file.id') ->join('for_users', 'str_owners.user_id', '=', 'for_users.id') ->where('file_id', $id) ->get(array( "file_id", "user_id", "title", "version", "description", "changelog", "views", "downloads", "submit_date", "last_date", "username", "avatar", "perm_id", "gender", "display_name", "name_colour", )); } public function getFileTitle($id) { // /api/rpc/store/file/getfiletitle/id return DB::table('str_owners') ->join('str_file', 'str_owners.file_id', '=', 'str_file.id') ->join('for_users', 'str_owners.user_id', '=', 'for_users.id') ->where('file_id', $id) ->get(array( "user_id", "title", "version", "views", "downloads", "submit_date", "last_date", "username", "avatar", "perm_id", "gender", "display_name", "name_colour", )); } public function getFileDescription($id) { // /api/rpc/store/file/getfiledescription/id return DB::table('str_file') ->select('description') ->where('id', $id) ->get(); } public function getFileChangelog($id) { // /api/rpc/store/file/getfilechangelog/id return DB::table('str_file') ->select('changelog', 'version') ->where('id', $id) ->get(); } public function getFilesInCategory($cat_id) { // /api/rpc/store/file/getfilesincategory/cat_id return DB::table('str_file') ->select('*') ->where('cat_id', $cat_id) ->get(); } public function insertEntry(Request $request) { // /api/rpc/store/file/insert return; } public function updateEntry(Request $request) { // /api/rpc/store/file/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/file/restore return DB::table('str_file') ->where('id', $request->id) ->update(['isApproved', 1]); } public function removeEntry(Request $request) { // /api/rpc/store/file/remove return DB::table('str_file') ->where('id', $request->id) ->update(['isApproved', 0]); } }