'未提取', self::STATUS_USED => '已提取', self::STATUS_SIGN => '已核销', ]; public $dates=[ 'get_at','pick_at' ]; /** * Notes: 生成人-管理人 * * @Author: 玄尘 * @Date: 2023/1/11 13:41 * @return BelongsTo */ public function manage(): BelongsTo { return $this->belongsTo(User::class); } /** * Notes: 设置使用 * * @Author: 玄尘 * @Date: 2023/1/12 14:25 */ public function used() { $this->status = self::STATUS_USED; $this->save(); } /** * Notes: 核销 * * @Author: 玄尘 * @Date: 2023/1/16 11:15 */ public function sign() { $this->order->state = Order::STATUS_SIGNED; $this->order->save(); $this->status = self::STATUS_SIGN; $this->pick_at = now(); $this->save(); return true; } /** * Notes: 关联订单 * * @Author: 玄尘 * @Date: 2023/1/12 15:02 * @return \Illuminate\Database\Eloquent\Relations\HasOne */ public function order() { return $this->hasOne(Order::class); } }