wyyl/beike/Models/AttributeValue.php

40 lines
901 B
PHP

<?php
/**
* AttributeValue.php
*
* @copyright 2023 beikeshop.com - All Rights Reserved
* @link https://beikeshop.com
* @author TL <mengwb@guangda.work>
* @created 2023-01-03 20:22:18
* @modified 2023-01-03 20:22:18
*/
namespace Beike\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class AttributeValue extends Base
{
use HasFactory;
protected $fillable = ['attribute_id'];
public function description()
{
return $this->hasOne(AttributeValueDescription::class)->where('locale', locale());
}
public function descriptions() :HasMany
{
return $this->hasMany(AttributeValueDescription::Class);
}
public function attribute() :BelongsTo
{
return $this->belongsTo(Attribute::Class);
}
}