Created
August 3, 2020 12:11
-
-
Save thephucit/db4911869ba9cc26fd0da49eb81d5b6e to your computer and use it in GitHub Desktop.
octobercms extend refresh fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function formExtendRefreshFields($formWidget, $fields) | |
{ | |
$model = $fields['model']->value; | |
$values = $model::all()->toArray(); | |
$values = array_column($values, 'code'); | |
$fields['code']->value = join(', ', $values); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment