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/farmfun.komma.pro/app/Komma/Kiyoh/Models/Review.php
<?php

namespace App\Komma\Kiyoh\Models;

use App\Komma\Kiyoh\KiyohService;
use App\Komma\Locations\Models\Location;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class Review extends Model
{
    /** @var array */
    protected $casts = [
        'payload' => 'array',
        'recommendation' => 'boolean',
    ];

    /** @var array */
    protected $guarded = [];

    public function __construct(array $attributes = [])
    {
        $this->setTable(config('kiyoh.table_name'));

        parent::__construct($attributes);
    }

    public function location():BelongsTo
    {
        return $this->belongsTo(Location::class);
    }

    public function getStarsAttribute()
    {
        $kiyohService = app(KiyohService::class);

        return $kiyohService->kiyohReviewStarsObject($this->rating);
    }
}