@@ 279-319 (lines=41) @@ | ||
276 | else{ |
|
277 | $api->save(); |
|
278 | $this->saveHistory($api, $workflow->first(), $statesFrom->first(), $statesTo->first(), $user_id); |
|
279 | if($requests == 'Request'){ |
|
280 | $model = "ApiKeys"; |
|
281 | $fromState = "propose"; |
|
282 | $toState = $requests; |
|
283 | $workflow = $this->getWorkflow($model); |
|
284 | $statesFrom = $this->getState($fromState); |
|
285 | $statesTo = $this->getState($toState); |
|
286 | if($workflow->count() == 0){ |
|
287 | $error = true; |
|
288 | $statusCode = 404; |
|
289 | $title = 'Error'; |
|
290 | $type = 'error'; |
|
291 | $message = 'Error Workflow not found'; |
|
292 | $result = 'Not Found'; |
|
293 | } |
|
294 | elseif($statesTo->count() == 0 || $statesFrom->count() == 0){ |
|
295 | $error = true; |
|
296 | $statusCode = 404; |
|
297 | $title = 'Error'; |
|
298 | $type = 'error'; |
|
299 | $message = 'Error State not active or State not found'; |
|
300 | $result = 'Not Found'; |
|
301 | } |
|
302 | else{ |
|
303 | $this->saveHistory($api, $workflow->first(), $statesFrom->first(), $statesTo->first(), $user_id); |
|
304 | $error = false; |
|
305 | $statusCode = 200; |
|
306 | $title = 'Success'; |
|
307 | $type = 'success'; |
|
308 | $message = 'Data created successfully. Your request has already been send.'; |
|
309 | $result = $request->all(); |
|
310 | } |
|
311 | } |
|
312 | else{ |
|
313 | $error = true; |
|
314 | $statusCode = 404; |
|
315 | $title = 'Error'; |
|
316 | $type = 'error'; |
|
317 | $message = 'Value Request must be Request.'; |
|
318 | $result = $request->all(); |
|
319 | } |
|
320 | } |
|
321 | } |
|
322 | else { |
|
@@ 352-394 (lines=43) @@ | ||
349 | $message = 'Data has already been Rejected.'; |
|
350 | $result = $request->all(); |
|
351 | } |
|
352 | else { |
|
353 | if($requests == 'Request'){ |
|
354 | $model = "ApiKeys"; |
|
355 | $fromState = "propose"; |
|
356 | $toState = $requests; |
|
357 | $workflow = $this->getWorkflow($model); |
|
358 | $statesFrom = $this->getState($fromState); |
|
359 | $statesTo = $this->getState($toState); |
|
360 | if($workflow->count() == 0){ |
|
361 | $error = true; |
|
362 | $statusCode = 404; |
|
363 | $title = 'Error'; |
|
364 | $type = 'error'; |
|
365 | $message = 'Error Workflow not found'; |
|
366 | $result = 'Not Found'; |
|
367 | } |
|
368 | elseif($statesTo->count() == 0 || $statesFrom->count() == 0){ |
|
369 | $error = true; |
|
370 | $statusCode = 404; |
|
371 | $title = 'Error'; |
|
372 | $type = 'error'; |
|
373 | $message = 'Error State not active or State not found'; |
|
374 | $result = 'Not Found'; |
|
375 | } |
|
376 | else{ |
|
377 | $this->saveHistory($get, $workflow->first(), $statesFrom->first(), $statesTo->first(), $user_id); |
|
378 | $error = false; |
|
379 | $statusCode = 200; |
|
380 | $title = 'Success'; |
|
381 | $type = 'success'; |
|
382 | $message = 'Data created successfully. Your request has already been send.'; |
|
383 | $result = $request->all(); |
|
384 | } |
|
385 | } |
|
386 | else { |
|
387 | $error = true; |
|
388 | $statusCode = 404; |
|
389 | $title = 'Error'; |
|
390 | $type = 'error'; |
|
391 | $message = 'Value Request must be Request.'; |
|
392 | $result = $request->all(); |
|
393 | } |
|
394 | } |
|
395 | } |
|
396 | } catch (Exception $e) { |
|
397 | $error = true; |