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);
}
}