We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 96fec6c commit d415e17Copy full SHA for d415e17
WebmanReadme.md
@@ -60,4 +60,33 @@ class Handler extends ExceptionHandler
60
}
61
```
62
63
-**注意:头请求未声明此次请求需要返回 json 数据时,`$this->fail($message, $err_code)` 的错误码需要符合 http status_code 响应码**
+## 控制器调用
64
+
65
+```
66
+<?php
67
68
+namespace app\controller;
69
70
+class DemoController extends WebmanBaseController
71
+{
72
+ public function index()
73
+ {
74
+ // validate data
75
+ \validator()->validate(\request(), [
76
+ 'name' => 'required|string',
77
+ 'age' => 'nullable|integer',
78
+ ]);
79
80
+ // your logic
81
+ $error = false;
82
+ if ($error) {
83
+ throw new \RuntimeException('error message');
84
+ }
85
86
+ return $this->success([
87
+ 'key1' => 'value1',
88
+ 'key2' => 'value2',
89
90
91
+}
92
0 commit comments