File: D:/HostingSpaces/SBogers10/ste.komma.pro/vendor/komma/feedback-company/src/Resources/Review.php
<?php
namespace Komma\FeedbackCompany\Resources;
use Komma\FeedbackCompany\Base\ApiResource;
use Komma\FeedbackCompany\Base\ResourceFactory;
use Carbon\Carbon;
class Review extends ApiResource implements RenderableInterface
{
protected array $ignoredAttributes = [
'shop',
'filtercode',
'vestiging',
'status',
'isRevised',
'reinviteSent',
'isRead',
'review_ref',
'buy_online'
];
protected array $dates = [
'date_created',
'date_updated',
'shop_comment_date',
'publish_date',
];
protected array $remappedAttributes = [
'total_score' => 'score'
];
public int $id;
public int $score;
public string $product;
public $client;
public $recommends;
public array $questions;
public array $_questions;
public string $shop_comment;
public Carbon $date_created;
public Carbon $date_updated;
public Carbon $shop_comment_date;
public Carbon $publish_date;
public function render(): void
{
if(sizeof($this->questions) > 0) $this->convertQuestionsIntoResources();
}
/**
* Will convert the values of the products attributes into Product resources
*/
private function convertQuestionsIntoResources()
{
$this->_questions = $this->questions;
$this->questions = ResourceFactory::createFromApiResultArray($this->questions, Question::class);
}
}