public function check($templateId) { $template = Template::with("contentfields")->whereId($templateId)->first(); if (count($template->contentfields) > 0) { return view("back.contentfields.edit", compact("template")); } return view("back.contentfields.create", compact("template")); }