function inputs() { $is = []; $sectionId = Request::route('id2'); foreach (Item::where('section_id', '=', $sectionId)->get() as $item) { $is = $item->render($is, null); } return $is; }
function inputs($post) { $is = []; $sectionId = $post->section()->get()->first()->id; foreach (Item::where('section_id', '=', $sectionId)->get() as $item) { $content = $item->content()->where('post_id', '=', $post->id)->get()->first(); $is = $item->render($is, $content); } return $is; }
function definition($def = []) { $is = []; $sectionId = Post::find(Request::route('id2'))->section()->first()->id; foreach (Item::where('section_id', '=', $sectionId)->get() as $item) { $content = $item->content()->where('post_id', '=', Request::route('id2'))->get()->first(); $is = $item->render($is, $content); } return parent::definition(['Form ID' => $this->getHeader() . "-form", 'Submit Button Text' => 'Save', 'Inputs' => $is]); }