2022-07-26 20:05:14 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
2024-08-16 17:19:12 +08:00
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
|
|
2022-07-26 20:05:14 +08:00
|
|
|
class GoodsType extends Model
|
|
|
|
|
{
|
2024-08-16 17:19:12 +08:00
|
|
|
use SoftDeletes;
|
2022-07-28 13:46:08 +08:00
|
|
|
/**
|
|
|
|
|
* 数组中的属性会被隐藏。
|
|
|
|
|
*
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
|
|
|
|
protected $hidden = ['deleted_at'];
|
2024-08-12 19:36:42 +08:00
|
|
|
|
2024-08-14 17:02:31 +08:00
|
|
|
public function parentType()
|
2024-08-12 19:36:42 +08:00
|
|
|
{
|
2024-08-14 17:02:31 +08:00
|
|
|
return $this->hasOne(GoodsType::class, 'id', 'parent_id');
|
2024-08-12 19:36:42 +08:00
|
|
|
}
|
2022-07-26 20:05:14 +08:00
|
|
|
}
|