mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?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());
|
|
}
|
|
}
|
|
}
|