|
|
|
@ -0,0 +1,39 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
namespace App\Models; |
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory; |
|
|
|
|
|
|
|
class Special extends BaseModel |
|
|
|
{ |
|
|
|
use HasFactory; |
|
|
|
|
|
|
|
//轮播图片
|
|
|
|
public function getPictureAttribute($value): array |
|
|
|
{ |
|
|
|
$value = json_decode($value, true); |
|
|
|
if (is_array($value)) { |
|
|
|
foreach ($value as &$v) { |
|
|
|
$v = $v ? $this->host . $v : ''; |
|
|
|
} |
|
|
|
} |
|
|
|
return $value; |
|
|
|
} |
|
|
|
|
|
|
|
//首页广告图
|
|
|
|
public function getPictureAdAttribute($value): string |
|
|
|
{ |
|
|
|
return $value ? $this->host . $value : ''; |
|
|
|
} |
|
|
|
|
|
|
|
//代理商产品ID
|
|
|
|
public function getAgentProductIdAttribute($value) |
|
|
|
{ |
|
|
|
return explode(',', $value); |
|
|
|
} |
|
|
|
|
|
|
|
public function agentProduct() |
|
|
|
{ |
|
|
|
return $this->belongsTo(AgentProduct::class); |
|
|
|
} |
|
|
|
} |