| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentForm\App\Http\Controllers; |
| 4 |
|
| 5 |
use Exception; |
| 6 |
use FluentForm\App\Services\Report\ReportService; |
| 7 |
|
| 8 |
class ReportController extends Controller |
| 9 |
{ |
| 10 |
public function form(ReportService $reportService) |
| 11 |
{ |
| 12 |
try { |
| 13 |
return $this->sendSuccess( |
| 14 |
$reportService->form($this->request->all()) |
| 15 |
); |
| 16 |
} catch (Exception $e) { |
| 17 |
return $this->sendError([ |
| 18 |
'message' => $e->getMessage(), |
| 19 |
]); |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
/** |
| 24 |
* Get Submission Report |
| 25 |
* @return \WP_REST_Response |
| 26 |
*/ |
| 27 |
public function submissions(ReportService $reportService) |
| 28 |
{ |
| 29 |
try { |
| 30 |
return $this->sendSuccess( |
| 31 |
$reportService->submissions($this->request->all()) |
| 32 |
); |
| 33 |
} catch (Exception $e) { |
| 34 |
return $this->sendError([ |
| 35 |
'message' => $e->getMessage(), |
| 36 |
]); |
| 37 |
} |
| 38 |
} |
| 39 |
} |
| 40 |
|