Files
RomhackPlaza/app/Models/EntryReview.php
2026-06-23 19:24:38 +02:00

64 lines
2.7 KiB
PHP

<?php
namespace App\Models;
use App\Traits\HasXenforoUserId;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Str;
use League\CommonMark\GithubFlavoredMarkdownConverter;
/**
* @property int $id
* @property int $entry_id
* @property string $title
* @property int $rating
* @property string $description
* @property string|null $deleted_at
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \App\Models\Entry|null $entry
* @method static \Illuminate\Database\Eloquent\Builder<static>|EntryReview newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|EntryReview newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|EntryReview query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|EntryReview whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EntryReview whereDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EntryReview whereDescription($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EntryReview whereEntryId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EntryReview whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EntryReview whereRating($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EntryReview whereTitle($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EntryReview whereUpdatedAt($value)
* @property int $user_id
* @method static \Illuminate\Database\Eloquent\Builder<static>|EntryReview whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EntryReview onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder<static>|EntryReview withTrashed(bool $withTrashed = true)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EntryReview withoutTrashed()
* @property-read string $description_html
* @mixin \Eloquent
*/
class EntryReview extends Model
{
use HasXenforoUserId, SoftDeletes;
protected $fillable = [ 'entry_id', 'title', 'rating', 'description', 'user_id' ];
public function entry(): BelongsTo
{
return $this->belongsTo(Entry::class);
}
public function getDescriptionHtmlAttribute(): string
{
$converter = new GithubFlavoredMarkdownConverter([
'html_input' => 'strip',
'allow_unsafe_links' => false,
]);
return $converter->convert($this->description)->getContent();
}
}