This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
roulendz
I need some guidance:
I want to generate Grouped dropdown for backend form.
I pass an array with nested items
return Course::where('school_id', self::getAuthSchoolId())->with('lessons')->get()->toArray();
doing dd($courses)
array:2 [▼
0 => array:13 [▼
"id" => 3
"school_id" => 2
"slug" => "test"
"title" => "Test course"
"description" => "Test description!"
"excerpt" => "Short test"
"public_description" => "###Test"
"image_path" => null
"price" => 25000
"created_at" => "2018-03-04 21:19:44"
"updated_at" => "2018-03-04 21:19:44"
"deleted_at" => null
"lessons" => array:3 [▼
0 => array:17 [▶]
1 => array:17 [▶]
2 => array:17 [▶]
]
]
1 => array:13 [▶]
]
and running
<?php foreach ($courses as $course) {
$course->id;
}
?>
gives error
Trying to get property of non-object
I just want grouped dropdown! https://octobercms.com/docs/ui/form
Last updated
1-1 of 1