mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-21 05:23:58 +00:00
Admin Workflow Initial Commit
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Questionnaires\Processors;
|
||||
|
||||
|
||||
use App\Classes\Modules\Questionnaires\Services\FetchesQuestion;
|
||||
use App\Models\QAQuestionnaireSet;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
class FetchFirstQuestionV1AdminWFProcessor
|
||||
{
|
||||
/** @var FetchesQuestion */
|
||||
private $fetchesQuestion;
|
||||
|
||||
/**
|
||||
* FetchFirstQuestionV1AdminWFProcessor constructor.
|
||||
* @param FetchesQuestion $fetchesQuestion
|
||||
*/
|
||||
public function __construct(FetchesQuestion $fetchesQuestion)
|
||||
{
|
||||
$this->fetchesQuestion = $fetchesQuestion;
|
||||
}
|
||||
|
||||
public function execute(Request $request){
|
||||
try {
|
||||
$setId = $request->route('set_id');
|
||||
if($setId === '0'){
|
||||
$set = QAQuestionnaireSet::where('group', 'workflow')->latest('id')->first();
|
||||
$setId = $set->id;
|
||||
}
|
||||
$query = $this->fetchesQuestion->execute(['questionnaire_set_id' => $setId]);
|
||||
return $query;
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user