You've already forked Atomcms-edit
54 lines
1.2 KiB
PHP
Executable File
54 lines
1.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models\Community\RareValue;
|
|
|
|
use App\Models\Game\Furniture\CatalogItem;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property string $item_name
|
|
* @property int $category_id
|
|
* @property int $item_id
|
|
* @property int $currency_type
|
|
* @property int $cost
|
|
* @property Carbon|null $created_at
|
|
* @property Carbon|null $updated_at
|
|
* @property-read WebsiteRareValueCategory|null $category
|
|
* @property-read CatalogItem|null $item
|
|
*/
|
|
class WebsiteRareValue extends Model
|
|
{
|
|
#[\Override]
|
|
protected $guarded = ['id', 'created_at', 'updated_at'];
|
|
|
|
#[\Override]
|
|
protected function casts()
|
|
{
|
|
return [
|
|
'currency_type' => 'integer',
|
|
];
|
|
}
|
|
|
|
public function category(): BelongsTo
|
|
{
|
|
return $this->belongsTo(WebsiteRareValueCategory::class, 'category_id');
|
|
}
|
|
|
|
public function item(): BelongsTo
|
|
{
|
|
return $this->belongsTo(CatalogItem::class, 'item_id', 'item_ids');
|
|
}
|
|
|
|
public function isLimitedEdition(): bool
|
|
{
|
|
if (is_null($this->item)) {
|
|
return false;
|
|
}
|
|
|
|
return $this->item->limited_stack > 0;
|
|
}
|
|
}
|