HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
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);
    }

}