We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assalamualaikum Om Munir,
Saya punya dua model yang saling berelasi,
Relasinya, Satu Buku Bank mempunyai Satu VoucherCode
Ketika ingin menyimpan record pada buku bank, code seperti ini:
[ 'class' => 'mdm\autonumber\Behavior', 'attribute' => 'reference_number', 'group' => $this->id, 'value' => $this->voucherCode->code . '?' . '-' . date('Y'), #### [ menggunakan attribute dari relasi ] ### 'digit' => 5 ],
Hasil yang didapat belum selesai : 00005-2020 Saya akalin dengan membuat seperti ini.
public $voucher; public function beforeSave($insert) { parent::beforeSave($insert); // TODO: Change the autogenerated stub if($insert){ $this->voucher = VoucherCode::findOne($this->voucher_code_id)->code; // Test pakai Vardump, nilainya ada } } public function rules() { return ArrayHelper::merge( parent::rules(), [ # custom validation rules ['voucher', 'safe'] ] ); } public function behaviors() { return ArrayHelper::merge( parent::behaviors(), [ # custom behaviors [ 'class' => 'mdm\autonumber\Behavior', 'attribute' => 'reference_number', 'group' => $this->id, 'value' => $this->voucher . '?' . '-' . date('Y'), 'digit' => 5 ], ] ); }
Masih belum bisa juga. Mohon saran dan bantuannya.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Assalamualaikum Om Munir,
Saya punya dua model yang saling berelasi,
Relasinya, Satu Buku Bank mempunyai Satu VoucherCode
Ketika ingin menyimpan record pada buku bank, code seperti ini:
Hasil yang didapat belum selesai : 00005-2020
Saya akalin dengan membuat seperti ini.
Masih belum bisa juga.
Mohon saran dan bantuannya.
The text was updated successfully, but these errors were encountered: