diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php
index 4b64afc..cdfc274 100644
--- a/app/Http/Controllers/CategoryController.php
+++ b/app/Http/Controllers/CategoryController.php
@@ -33,4 +33,8 @@ class CategoryController extends Controller {
->where('id', $id)
->get();
}
+
+ public function category($cat_id) { // /category/cat_id
+ return view('category', compact('cat_id'));
+ }
}
diff --git a/app/Http/Controllers/FileController.php b/app/Http/Controllers/FileController.php
index bfa368c..d055f9d 100644
--- a/app/Http/Controllers/FileController.php
+++ b/app/Http/Controllers/FileController.php
@@ -35,21 +35,21 @@ class FileController extends Controller {
}
public function getNewFiles() { // /api/rpc/file/getnewfiles
- return DB::table('str_file')
- ->select('id', 'title', 'submit_date')
- ->where('isApproved', 1)
- ->orderBy('submit_date', 'desc')
- ->limit(5)
- ->get();
+ return DB::table('str_file')
+ ->select('id', 'title', 'submit_date')
+ ->where('isApproved', 1)
+ ->orderBy('submit_date', 'desc')
+ ->limit(5)
+ ->get();
}
public function getHotFiles() { // /api/rpc/file/gethotfiles
- return DB::table('str_file')
- ->select('id', 'title', 'downloads')
- ->where('isApproved', 1)
- ->orderBy('downloads', 'desc')
- ->limit(5)
- ->get();
+ return DB::table('str_file')
+ ->select('id', 'title', 'downloads')
+ ->where('isApproved', 1)
+ ->orderBy('downloads', 'desc')
+ ->limit(5)
+ ->get();
}
public function getFilesPageAll($cat, $from, $to) { // /api/rpc/file/getfilespageall/cat/from/to
diff --git a/app/Http/Controllers/OwnerController.php b/app/Http/Controllers/OwnerController.php
index 148ec64..837a76d 100644
--- a/app/Http/Controllers/OwnerController.php
+++ b/app/Http/Controllers/OwnerController.php
@@ -7,32 +7,60 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class OwnerController extends Controller {
- public function getOwners() { // /api/rpc/owner/getowners
- // $getUsers = DB::table('for_users')->select('id', 'username', 'display_name', 'name_colour', 'group', 'gender', 'avatar');
+ public function countOwnersOfFile($file_id) { // /api/rpc/owner/countownersoffile/id
return DB::table('str_owners')
- ->select('*')
- // ->union($getUsers)
- ->get();
+ ->where('file_id', $file_id)
+ ->count();
}
- public function getOwner($id) { // /api/rpc/owner/getowner/id
+ public function getOwnersOfFile($file_id) { // /api/rpc/owner/getownersoffile/id
return DB::table('str_owners')
- ->select('*')
- ->where('id', $id)
- ->get();
+ ->join('str_file', 'str_owners.file_id', '=', 'str_file.id')
+ ->join('for_users', 'str_owners.user_id', '=', 'for_users.id')
+ ->where('file_id', $file_id)
+ ->get(array(
+ "user_id",
+ "title",
+ "version",
+ "views",
+ "downloads",
+ "submit_date",
+ "last_date",
+ "username",
+ "avatar",
+ "perm_id",
+ "gender",
+ "display_name",
+ "name_colour",
+ ));
}
- public function getOwnerFile($file_id) { // /api/rpc/owner/getownerfile/id
+ public function countFilesOfOwner($user_id) { // /api/rpc/owner/countfilesofowner/id
return DB::table('str_owners')
- ->select('*')
- ->where('file_id', $file_id)
- ->get();
+ ->where('user_id', $user_id)
+ ->count();
}
- public function getOwnerUser($user_id) { // /api/rpc/owner/getowneruser/id
+
+ public function getFilesOfOwner($user_id) { // /api/rpc/owner/getfilesofowner/id
return DB::table('str_owners')
- ->select('*')
- ->where('user_id', $user_id)
- ->get();
+ ->join('str_file', 'str_owners.file_id', '=', 'str_file.id')
+ ->join('for_users', 'str_owners.user_id', '=', 'for_users.id')
+ ->where('user_id', $user_id)
+ ->get(array(
+ "user_id",
+ "title",
+ "version",
+ "views",
+ "downloads",
+ "submit_date",
+ "last_date",
+ "username",
+ "avatar",
+ "perm_id",
+ "gender",
+ "display_name",
+ "name_colour",
+ ));
}
}
diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js
index d32e30e..9cc79ef 100644
--- a/resources/assets/js/app.js
+++ b/resources/assets/js/app.js
@@ -27,6 +27,11 @@ Vue.component('entry-screenshots', require('./components/Entry/Screenshots.vue')
Vue.component('entry-description', require('./components/Entry/Description.vue'));
Vue.component('entry-changelog', require('./components/Entry/Changelog.vue'));
+// Category page.
+Vue.component('category-entry', require('./components/Category/All.vue'));
+Vue.component('category-entry-downloads', require('./components/Category/Downloads.vue'));
+Vue.component('category-entry-views', require('./components/Category/Views.vue'));
+
new Vue({
el: '#app'
});
diff --git a/resources/assets/js/components/Category/All.vue b/resources/assets/js/components/Category/All.vue
new file mode 100644
index 0000000..9b78c44
--- /dev/null
+++ b/resources/assets/js/components/Category/All.vue
@@ -0,0 +1,131 @@
+
+
+ Submitted on {{ e.submit_date }}
+
+ , last updated on {{ e.last_date }}
+
+
+ {{ e.downloads }} downloads
+
+ {{ e.views }} views
+
+ {{ e.description }}
+
+ Submitted on {{ e.submit_date }}
+
+ , last updated on {{ e.last_date }}
+
+
+ {{ e.downloads }} downloads
+
+ {{ e.views }} views
+
+ {{ e.description }}
+
+ Submitted on {{ e.submit_date }}
+
+ , last updated on {{ e.last_date }}
+
+
+ {{ e.downloads }} downloads
+
+ {{ e.views }} views
+
+ {{ e.description }}
+