unicornshop/app/Models/GoodsGroup.php
2026-05-29 22:55:10 +08:00

43 lines
762 B
PHP

<?php
namespace App\Models;
use App\Events\GoodsGroupDeleted;
use Illuminate\Database\Eloquent\SoftDeletes;
class GoodsGroup extends BaseModel
{
use SoftDeletes;
protected $table = 'goods_group';
protected $dispatchesEvents = [
'deleted' => GoodsGroupDeleted::class
];
protected $hidden = [
'group_pwd',
];
protected $casts = [
'is_open_group_pwd' => 'integer',
];
/**
* 关联商品
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*
* @author assimon<ashang@utf8.hk>
* @copyright assimon<ashang@utf8.hk>
* @link http://utf8.hk/
*/
public function goods()
{
return $this->hasMany(Goods::class, 'group_id');
}
}