You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
615 B
33 lines
615 B
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
class Special extends BaseModel
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $casts = ['picture' => 'array'];
|
|
|
|
//轮播图片
|
|
public function getPictureAttribute($value): array
|
|
{
|
|
$value = json_decode($value, true);
|
|
return $value;
|
|
}
|
|
|
|
//代理商产品ID
|
|
public function getAgentProductIdAttribute($value)
|
|
{
|
|
return explode(',', $value);
|
|
}
|
|
|
|
//代理商产品ID
|
|
public function setAgentProductIdAttribute($value)
|
|
{
|
|
if (is_array($value)) {
|
|
$this->attributes['agent_product_id'] = join(',', $value);
|
|
}
|
|
}
|
|
}
|