You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
676 B
29 lines
676 B
<?php
|
|
|
|
namespace App\Http\Controllers\Miniapp;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\ResearchDirection;
|
|
use App\Support\ApiResponse;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
class ResearchDirectionController extends Controller
|
|
{
|
|
use ApiResponse;
|
|
|
|
public function options(): JsonResponse
|
|
{
|
|
$items = ResearchDirection::query()
|
|
->where('status', 1)
|
|
->orderBy('sort')
|
|
->orderBy('name')
|
|
->get(['id', 'name'])
|
|
->map(fn (ResearchDirection $row) => [
|
|
'id' => $row->id,
|
|
'name' => $row->name,
|
|
]);
|
|
|
|
return $this->ok(['items' => $items]);
|
|
}
|
|
}
|