how access through relationship value using select field #568
-
Beta Was this translation helpful? Give feedback.
Answered by
christmex
Jul 13, 2023
Replies: 1 comment 1 reply
-
Hi, i decide to manipulate the data inside CRUD::addfield([
'label' => "Kelas",
'type' => 'select',
'name' => 'school_classroom_config_id',
'entity' => 'SchoolClassroomConfig',
'model' => "App\Models\SchoolClassroomConfig",
'attribute' => 'classroom',
'allows_null' => false,
'options' => (function ($query) use($schoolId) {
$query = $query->with('classroom')->whereIn('school_id', $schoolId)->get();
foreach ($query as $key => $value) {
$value->classroom_name = $value->classroom->classroom_name;
}
return($query);
}),
]); then I achieve what I want, they key still using the thanks guys 🙏 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
christmex
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, i decide to manipulate the data inside
options
key, so it look like thisthen I achieve what I …