/** * Show all contacts in the specified contact category * @param $alias * @return */ public function showCategory($alias) { $category = ContactCategory::with('contacts')->whereAlias($alias)->first(); if (!$category) { App::abort(404); } $this->layout->title = "Contact in {$category->name}"; $this->layout->content = View::make("public.{$this->current_theme}.contact-categories")->with('title', "Contact in {$category->name}")->with('category', $category); }
/** * Show the form for editing the specified resource. * * @param int $id * @param $form_id */ public function edit($id, $form_id) { // Get only the form that matches the specified form id $form = $this->getForm($form_id); $model_name = "Components\\ContactManager\\Models\\{$form['model']}"; $entry = $model_name::findOrFail($id); $categories = ContactCategory::lists('name', 'id'); $entry->location = json_decode($entry->location, true); $this->layout->title = "Edit contact in {$this->module_name}"; $this->layout->content = View::make("contact_manager::create_edit")->with('title', "Edit contact in module {$this->module_name}")->with('entry', $entry)->with('form', $form)->with('categories', $categories); }
/** * Remove the specified contact category from storage. * * @param int $id * @return Response */ public function destroy($id = null) { // If multiple ids are specified if ($id == 'multiple') { $selected_ids = trim(Input::get('selected_ids')); if ($selected_ids == '') { return Redirect::back()->with('error_message', trans('error_messages.nothing_selected_delete')); } $selected_ids = explode(' ', $selected_ids); } else { $selected_ids = array($id); } foreach ($selected_ids as $id) { $contact_cat = ContactCategory::findOrFail($id); $contact_cat->delete(); } $wasOrWere = count($selected_ids) > 1 ? ' were' : ' was'; $message = trans('success_messages.contact_cat_delete'); return Redirect::to("backend/contact-categories")->with('success_message', $message); }