SubjectController.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace App\Http\Controllers\Admin;
  3. use App\Services\Exam\SubjectService;
  4. /**
  5. * 课程管理-控制器
  6. */
  7. class SubjectController extends Backend
  8. {
  9. public function __construct()
  10. {
  11. parent::__construct();
  12. $this->service = SubjectService::make();
  13. }
  14. // GET /admin/subjects
  15. public function index()
  16. {
  17. $pageSize = request()->get('limit', 10);
  18. $list = $this->service->customList(request()->all(), $pageSize);
  19. $message = array(
  20. "msg" => '操作成功',
  21. "code" => 0,
  22. "data" => isset($list['list']) ? $list['list'] : [],
  23. "count" => isset($list['total']) ? $list['total'] : 0,
  24. );
  25. return $message;
  26. }
  27. public function edit()
  28. {
  29. return parent::edit(); // TODO: Change the autogenerated stub
  30. }
  31. /**
  32. * 选项列表
  33. * @return mixed
  34. */
  35. public function options()
  36. {
  37. $result = $this->service->options();
  38. return message(1002, true, $result);
  39. }
  40. }