File controller works.
このコミットが含まれているのは:
コミット
59ae88c2ee
|
@ -2,51 +2,50 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class FileController extends Controller {
|
||||
public function __contruct() {
|
||||
// Init SQL.
|
||||
public function getAllFiles() { // /api/rpc/file/getallfiles
|
||||
return DB::table('str_file')->select('*')->get();
|
||||
}
|
||||
|
||||
public function getAllFiles() {
|
||||
// Select all users from the database, and return the results.
|
||||
public function getAllApprovedFiles() { // /api/rpc/file/getallapprovedfiles
|
||||
return DB::table('str_file')->select('*')->where('isApproved', 1)->get();
|
||||
}
|
||||
|
||||
public function getAllApprovedFiles() {
|
||||
// Select all users from the database, and return the results.
|
||||
public function getAllBrokenFiles() { // /api/rpc/file/getallbrokenfiles
|
||||
return DB::table('str_file')->select('*')->where('isBroken', 1)->get();
|
||||
}
|
||||
|
||||
public function getAllBrokenFiles() {
|
||||
// Select all users from the database, and return the results.
|
||||
public function getAllPendingFiles() { // /api/rpc/file/getallpendingfiles
|
||||
return DB::table('str_file')->select('*')->where('isApproved', 0)->get();
|
||||
}
|
||||
|
||||
public function getAllPendingFiles() {
|
||||
// Select all users from the database, and return the results.
|
||||
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();
|
||||
}
|
||||
|
||||
public function getFile($id) {
|
||||
// Select a specific user from the database, and return the result.
|
||||
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();
|
||||
}
|
||||
|
||||
public function getApprovedFile($id) {
|
||||
// Select a specific user from the database, and return the result.
|
||||
public function getFile($id) { // /api/rpc/file/getfile/id
|
||||
return DB::table('str_file')->select('*')->where('id', $id)->get();
|
||||
}
|
||||
|
||||
public function getBrokenFile($id) {
|
||||
// Select a specific user from the database, and return the result.
|
||||
}
|
||||
|
||||
public function getPendingFile($id) {
|
||||
// Select a specific user from the database, and return the result.
|
||||
}
|
||||
|
||||
public function getFilesInCategory($cat_id) {
|
||||
// Select a specific user from the database, and return the result.
|
||||
}
|
||||
|
||||
public function getWarningNotice(id) {
|
||||
// Select a specific user from the database, and return the result.
|
||||
public function getFilesInCategory($cat_id) { // /api/rpc/file/getfilesincategory/cat_id
|
||||
return DB::table('str_file')->select('*')->where('cat_id', $cat_id)->get();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,15 +28,13 @@ Route::get('/api/rpc/category/getcategoryminscrot/{id}', 'CategoryController@get
|
|||
|
||||
// File
|
||||
Route::get('/api/rpc/file/getallfiles', 'FileController@getAllFiles');
|
||||
Route::get('/api/rpc/file/getallfiles', 'FileController@getAllFiles');
|
||||
Route::get('/api/rpc/file/getallfiles', 'FileController@getAllFiles');
|
||||
Route::get('/api/rpc/file/getallfiles', 'FileController@getAllFiles');
|
||||
Route::get('/api/rpc/file/getallapprovedfiles', 'FileController@getAllApprovedFiles');
|
||||
Route::get('/api/rpc/file/getallbrokenfiles', 'FileController@getAllBrokenFiles');
|
||||
Route::get('/api/rpc/file/getallpendingfiles', 'FileController@getAllPendingFiles');
|
||||
Route::get('/api/rpc/file/getnewfiles', 'FileController@getNewFiles');
|
||||
Route::get('/api/rpc/file/gethotfiles', 'FileController@getHotFiles');
|
||||
Route::get('/api/rpc/file/getfile/{id}', 'FileController@getFile');
|
||||
Route::get('/api/rpc/file/getapprovedfile/{id}', 'FileController@getApprovedFile');
|
||||
Route::get('/api/rpc/file/getbrokenfile/{id}', 'FileController@getBrokenFile');
|
||||
Route::get('/api/rpc/file/getpendingfile/{id}', 'FileController@getPendingFile');
|
||||
Route::get('/api/rpc/file/getfileincategory{cat_id}', 'FileController@getFileInCategory');
|
||||
Route::get('/api/rpc/file/getwarningnotice/{id}', 'FileController@getWarningNotice');
|
||||
Route::get('/api/rpc/file/getfilesincategory/{cat_id}', 'FileController@getFilesInCategory');
|
||||
|
||||
// Owners
|
||||
Route::get('/api/rpc/owners/getowners', 'OwnerController@getOwners');
|
||||
|
|
新しいイシューから参照