63 行
2.0 KiB
PHP
63 行
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\ForUser;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
class UserController extends Controller {
|
|
public function getUsers() { // /api/rpc/user/getusers
|
|
return DB::table('for_users')
|
|
->select('*')
|
|
->get();
|
|
}
|
|
|
|
public function getUser($id) { // /api/rpc/user/getuser/id
|
|
return DB::table('for_users')
|
|
->select(
|
|
'id',
|
|
'username',
|
|
'perm_id', // Can't remember if this was used TBH.
|
|
'member_title',
|
|
'permission_id', // Same goes for this one.
|
|
'reg_date',
|
|
'website_address',
|
|
'website_name',
|
|
'gender',
|
|
'location',
|
|
'birthday',
|
|
'bio',
|
|
'avatar',
|
|
'timezone',
|
|
'strikes',
|
|
'name_colour',
|
|
'display_name',
|
|
'yt_channel',
|
|
'country',
|
|
'curTZ', 'curDF', 'curTF', // Time and date stuff
|
|
'usr_per_id', 'str_per_id', // Permission stuff.
|
|
// TODO: hide the following stuff away from unprivileaged users.
|
|
'email',
|
|
'ip_address',
|
|
'strikes'
|
|
)
|
|
->where('id', $id)
|
|
->get();
|
|
}
|
|
|
|
public function getGroupColours() { // /api/rpc/user/getgroupcolours
|
|
return DB::table('usr_perm_module')
|
|
->select(
|
|
'name',
|
|
'colour_m',
|
|
'colour_f',
|
|
'colour_u'
|
|
// 'badge' (this is a pipeline feature, please don't uncomment for now!)
|
|
)
|
|
->get();
|
|
}
|
|
}
|