where( 'status', self::STATUS_CLOSED ); } public function scopeOpened( $query ) { return $query->where( 'status', self::STATUS_OPENED ); } public function scopeInUse( $query ) { return $query->where( 'status', self::STATUS_INUSE ); } public function scopeDisabled( $query ) { return $query->where( 'status', self::STATUS_DISABLED ); } public function scopeUsedBy( $query, $user ) { return $query->where( 'used_by', $user ); } public function history() { return $this->hasMany( RegisterHistory::class, 'register_id', 'id' ); } public function user() { return $this->belongsTo( User::class, 'author_id' ); } public function cashier() { return $this->belongsTo( User::class, 'used_by' ); } }