| @@ 22-32 (lines=11) @@ | ||
| 19 | */ |
|
| 20 | public function handle($request, Closure $next) |
|
| 21 | { |
|
| 22 | if($request->header('apikey') == '') |
|
| 23 | { |
|
| 24 | return response()->json([ |
|
| 25 | 'error' => true, |
|
| 26 | 'status' => 200, |
|
| 27 | 'title' => 'Error', |
|
| 28 | 'type' => 'error', |
|
| 29 | 'message' => 'apikey not found', |
|
| 30 | 'result' => [] |
|
| 31 | ]); |
|
| 32 | } |
|
| 33 | $check = ApiKeys::where('api_key', $request->header('apikey'))->first(); |
|
| 34 | if(count($check) == 0) |
|
| 35 | { |
|
| @@ 34-44 (lines=11) @@ | ||
| 31 | ]); |
|
| 32 | } |
|
| 33 | $check = ApiKeys::where('api_key', $request->header('apikey'))->first(); |
|
| 34 | if(count($check) == 0) |
|
| 35 | { |
|
| 36 | return response()->json([ |
|
| 37 | 'error' => true, |
|
| 38 | 'status' => 200, |
|
| 39 | 'title' => 'Error', |
|
| 40 | 'type' => 'error', |
|
| 41 | 'message' => 'invalid apikey', |
|
| 42 | 'result' => [] |
|
| 43 | ]); |
|
| 44 | } |
|
| 45 | ||
| 46 | if(count($check) != 0){ |
|
| 47 | $history = History::with('getApiKeys') |
|
| @@ 67-76 (lines=10) @@ | ||
| 64 | 'result' => [] |
|
| 65 | ]); |
|
| 66 | } |
|
| 67 | elseif($workstateto == 'Request'){ |
|
| 68 | return response()->json([ |
|
| 69 | 'error' => true, |
|
| 70 | 'status' => 200, |
|
| 71 | 'title' => 'Error', |
|
| 72 | 'type' => 'error', |
|
| 73 | 'message' => 'invalid apikey', |
|
| 74 | 'result' => [] |
|
| 75 | ]); |
|
| 76 | } |
|
| 77 | elseif($workstateto == 'Rejected'){ |
|
| 78 | return response()->json([ |
|
| 79 | 'error' => true, |
|
| @@ 77-86 (lines=10) @@ | ||
| 74 | 'result' => [] |
|
| 75 | ]); |
|
| 76 | } |
|
| 77 | elseif($workstateto == 'Rejected'){ |
|
| 78 | return response()->json([ |
|
| 79 | 'error' => true, |
|
| 80 | 'status' => 200, |
|
| 81 | 'title' => 'Error', |
|
| 82 | 'type' => 'error', |
|
| 83 | 'message' => 'invalid apikey', |
|
| 84 | 'result' => [] |
|
| 85 | ]); |
|
| 86 | } |
|
| 87 | } |
|
| 88 | return $next($request); |
|
| 89 | } |
|