| Conditions | 5 |
| Paths | 5 |
| Total Lines | 24 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function handle($request, Closure $next) |
||
| 27 | { |
||
| 28 | $set = $this->setting->where('id', '1')->first(); |
||
|
|
|||
| 29 | if ($set->api_key_mandatory == 1) { |
||
| 30 | if ($set->api_enable == 1) { |
||
| 31 | $key = $set->api_key; |
||
| 32 | $check = $this->test($key, $request->input('api_key')); |
||
| 33 | if ($check == '1') { |
||
| 34 | return $next($request); |
||
| 35 | } |
||
| 36 | if ($check == '0') { |
||
| 37 | $result = 'wrong api key'; |
||
| 38 | |||
| 39 | return response()->json(compact('result')); |
||
| 40 | } |
||
| 41 | } else { |
||
| 42 | $result = 'please enable api'; |
||
| 43 | |||
| 44 | return response()->json(compact('result')); |
||
| 45 | } |
||
| 46 | } else { |
||
| 47 | return $next($request); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 60 |
If you implement
__calland you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__callis implemented by a parent class and only the child class knows which methods exist: