/** * All forms with their categories * @return array */ public static function all_forms() { $forms = array(0 => 'None'); $categories = BuiltForm::get(array('category')); foreach ($categories as $category) { $names = array(); foreach (BuiltForm::where('category', '=', $category->category)->get(array('id', 'name')) as $form) { // Get only the form names $names[$form->id] = $form->name; } $forms[FormCategory::find($category->category)->name] = $names; } return $forms; }