private function _generateId() { $id = str_random(10); if (!FormFields::where('unique_id', $id)->get()->isEmpty()) { return $this->_generateId(); } return $id; }
public function getEmbedForm($id = null) { if ($form = Forms::where('unique_id', $id)->where('status', 'active')->first()) { $form = Forms::where('unique_id', $id)->where('status', 'active')->first(); $fields = FormFields::where('form_id', $form->id)->get(); return View::make('frontend/forms/embed', compact('form', 'fields')); } }