SelectionController.php
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace App\Http\Container\ManageSection\Controllers;
use App\Models\Project;
use App\Models\SystemConfig;
use App\Models\SystemTag;
use App\Models\User;
use App\Support\Controller;
use Auth;
use Hikoon\LaravelApi\Facades\Response;
use Illuminate\Http\Request;
class SelectionController extends Controller
{
public function user(): Response
{
$data = User::query()->where('audit_status', 1)->latest('id')->get(['id', 'nick_name', 'real_name']);
return $this->successWithData($data);
}
/**
* @return \Hikoon\LaravelApi\Facades\Response
*/
public function project(Request $request): Response
{
$filter = $request->all();
$data = Project::filter($filter)
->whereRelation('managers', 'user_id', Auth::id())
->latest('weight')->get(['id', 'name', 'is_can_apply', 'is_can_demo_apply']);
return $this->successWithData($data);
}
/**
* @return \Hikoon\LaravelApi\Facades\Response
*/
public function tag(): Response
{
$data = SystemTag::query()->latest('weight')->get(['id', 'name', 'type']);
return $this->successWithData($data);
}
public function config(Request $request): Response
{
$data = SystemConfig::filter($request->all())->latest('weight')->get(['id', 'identifier', 'name', 'content', 'parent_id']);
return $this->successWithData($data);
}
}