123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- namespace App\Models;
- use App\Base\BaseModel;
- use App\Models\Goods\Goods;
- use Illuminate\Support\Arr;
- class Cart extends BaseModel
- {
- protected $table = "cart";
- protected $casts = [
- "extra" => "array",
- ];
- public function getThumbAttribute()
- {
- return Arr::get($this->extra, "thumb", "");
- }
- public function getSnAttribute()
- {
- return Arr::get($this->extra, "sn", "");
- }
- public function getSkuIdAttribute()
- {
- return Arr::get($this->extra, "sku_id", "");
- }
- public function getGoodsNameAttribute()
- {
- return Arr::get($this->extra, "goods_name", "");
- }
- public function getCustomAttribute()
- {
- return Arr::get($this->extra, "custom", []);
- }
- public function goods()
- {
- return $this->belongsTo(Goods::class);
- }
- }
|