function add_custom_text($title, $html) { $permalink = create_permalink($title); $insert = "INSERT INTO custom_texts VALUES (id, '" . $title . "', '" . $permalink . "', '" . $html . "', 'active')"; $result = mysql_query($insert); if (!$result) { echo $insert . "<br>"; die('Error Inserting into Database.'); } echo "<div class=\"center\"><h1>Success!</h1>" . "<h3>New Custom Text has been saved</h3>" . "<hr width=75%>"; display_custom_text(get_custom_text(mysql_insert_id())); echo "</div>"; }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update($id) { $tour = Tour::findOrFail($id); $input = Request::all(); $data = Tour::whereRaw('alias = ? AND id != ?', [$input['alias'], $id])->first(); if (!empty($data)) { $input['alias'] = create_permalink($input['alias']); } $photos = []; if (!empty($input['photo'])) { $temp = count($input['photo']); for ($i = 0; $i < $temp; $i++) { $photos[] = ['src' => $input['photo'][$i], 'title' => $input['title_img'][$i], 'desc' => $input['desc_img'][$i]]; } $input['photos'] = json_encode($photos); } $input['destinations'] = destination_encode($input['destinations']); $tour->fill($input)->save(); Session::flash('flash_message', 'Task successfully added!'); return redirect()->back(); }