Issue.php 975 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace App\Http\Controllers\admin;
  3. use App\Constants\HttpStatus;
  4. use App\Http\Controllers\Controller;
  5. use App\Services\IssueService;
  6. use Illuminate\Support\Facades\DB;
  7. use Illuminate\Validation\ValidationException;
  8. use Exception;
  9. class Issue extends Controller
  10. {
  11. /**
  12. * @description: 分页数据
  13. * @return {*}
  14. */
  15. function index()
  16. {
  17. try {
  18. request()->validate([
  19. 'issue_no' => ['nullable', 'string'],
  20. 'id' => ['nullable', 'string'],
  21. 'status' => ['nullable', 'string'],
  22. ]);
  23. $search = request()->all();
  24. $result = IssueService::paginate($search);
  25. } catch (ValidationException $e) {
  26. return $this->error(HttpStatus::VALIDATION_FAILED, $e->validator->errors()->first());
  27. } catch (Exception $e) {
  28. return $this->error(intval($e->getCode()));
  29. }
  30. return $this->success($result);
  31. }
  32. }