1234567891011121314151617181920212223242526272829 |
- <?php
- namespace Packages\Product\Models;
- use Illuminate\Database\Eloquent\SoftDeletes;
- use Illuminate\Database\Eloquent\Model;
- class Attribute extends Model
- {
- use SoftDeletes;
- protected $fillable=['title', 'key', 'use_in_veriation'];
- public function products()
- {
- return $this->morphedByMany(Product::class, 'attributable');
- }
- public function getUseInVeriationAttribute($value)
- {
- switch ($value) {
- case 0:
- $UseInVeriation = 'خیر';
- break;
- case 1:
- $UseInVeriation = 'بله';
- break;
- default:
- $UseInVeriation = '';
- }
- return $UseInVeriation ;
- }
- }
|