Skip to content

Commit

Permalink
Update for Custom Questions on Registrant
Browse files Browse the repository at this point in the history
  • Loading branch information
colinhall17 committed Sep 1, 2020
1 parent 4c142ac commit e3f3426
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 9 deletions.
9 changes: 7 additions & 2 deletions src/MeetingRegistrant.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand All @@ -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)){
Expand Down Expand Up @@ -47,7 +52,7 @@ public function approve()
{
return $this->updateAction('approve');
}

public function deny()
{
return $this->updateAction('deny');
Expand Down
18 changes: 15 additions & 3 deletions src/RegistrationQuestion.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
15 changes: 15 additions & 0 deletions src/Requests/StoreCustomQuestion.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace MacsiDigital\Zoom\Requests;

use MacsiDigital\API\Support\PersistResource;

class StoreCustomQuestion extends PersistResource
{

protected $persistAttributes = [
'title' => 'required|string',
'value' => 'required|string',
];

}
8 changes: 6 additions & 2 deletions src/Requests/StoreRegistrant.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];

}

protected $relatedResource = [
"custom_questions" => StoreCustomQuestion::class
];

}
10 changes: 8 additions & 2 deletions src/WebinarRegistrant.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand All @@ -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)){
Expand Down Expand Up @@ -47,7 +53,7 @@ public function approve()
{
return $this->updateAction('approve');
}

public function deny()
{
return $this->updateAction('deny');
Expand Down

0 comments on commit e3f3426

Please sign in to comment.