diff --git a/src/MeetingRegistrant.php b/src/MeetingRegistrant.php index 6c067de..674af51 100644 --- a/src/MeetingRegistrant.php +++ b/src/MeetingRegistrant.php @@ -7,7 +7,7 @@ class MeetingRegistrant extends Model { protected $insertResource = 'MacsiDigital\Zoom\Requests\StoreRegistrant'; - + protected $endPoint = 'meetings/{meeting:id}/registrants'; protected $allowedMethods = ['get', 'post', 'put']; @@ -19,6 +19,11 @@ public function getApiMultipleDataField() return $this->apiMultipleDataField; } + public function customQuestions() + { + return $this->hasMany(CustomQuestion::class); + } + public function beforeQuery($query) { if(isset($this->occurrence_id)){ @@ -47,7 +52,7 @@ public function approve() { return $this->updateAction('approve'); } - + public function deny() { return $this->updateAction('deny'); diff --git a/src/RegistrationQuestion.php b/src/RegistrationQuestion.php index 1f63c00..af9c53b 100644 --- a/src/RegistrationQuestion.php +++ b/src/RegistrationQuestion.php @@ -6,12 +6,24 @@ class RegistrationQuestion extends Model { - protected $insertResource = 'MacsiDigital\Zoom\Requests\UpdateRegistrantQuestion'; - + protected $insertResource = 'MacsiDigital\Zoom\Requests\UpdateRegistrationQuestion'; + protected $endPoint = 'meetings/{meeting:id}/registrants/questions'; - protected $allowedMethods = ['get', 'put']; + protected $allowedMethods = ['get', 'patch']; + + protected $createMethod = 'patch'; protected $apiMultipleDataField = ''; + public function questions() + { + return $this->hasMany(Question::class); + } + + public function customQuestions() + { + return $this->hasMany(CustomQuestion::class); + } + } diff --git a/src/Requests/StoreCustomQuestion.php b/src/Requests/StoreCustomQuestion.php new file mode 100644 index 0000000..d7ab4b5 --- /dev/null +++ b/src/Requests/StoreCustomQuestion.php @@ -0,0 +1,15 @@ + 'required|string', + 'value' => 'required|string', + ]; + +} diff --git a/src/Requests/StoreRegistrant.php b/src/Requests/StoreRegistrant.php index 0dd1ff3..8225eed 100644 --- a/src/Requests/StoreRegistrant.php +++ b/src/Requests/StoreRegistrant.php @@ -25,5 +25,9 @@ class StoreRegistrant extends PersistResource "no_of_employees" => "nullable|string|in:1-20,21-50,51-100,101-500,501-1,000,1,001-5,000,5,001-10,000,More than 10,000", "comments" => 'nullable|string|max:2000', ]; - -} \ No newline at end of file + + protected $relatedResource = [ + "custom_questions" => StoreCustomQuestion::class + ]; + +} diff --git a/src/WebinarRegistrant.php b/src/WebinarRegistrant.php index 3a71943..b5887da 100644 --- a/src/WebinarRegistrant.php +++ b/src/WebinarRegistrant.php @@ -7,7 +7,7 @@ class WebinarRegistrant extends Model { protected $insertResource = 'MacsiDigital\Zoom\Requests\StoreRegistrant'; - + protected $endPoint = 'webinars/{webinar:id}/registrants'; protected $allowedMethods = ['get', 'post', 'put']; @@ -19,6 +19,12 @@ public function getApiMultipleDataField() return $this->apiMultipleDataField; } + public function customQuestions() + { + return $this->hasMany(CustomQuestion::class); + } + + public function beforeQuery($query) { if(isset($this->occurrence_id)){ @@ -47,7 +53,7 @@ public function approve() { return $this->updateAction('approve'); } - + public function deny() { return $this->updateAction('deny');