public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { Note::create([]); } }
/** * Store a newly created note in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), Note::$rules); if (Request::ajax()) { $note = Note::create($data); return View::make('notes.panels.show', compact('note')); } else { if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } return View::make('notes.create'); } return Redirect::route('notes.index'); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $extensions = array('jpg', 'gif'); $links = array(); $input = Input::all(); for ($i = 0; $i < count(Input::get('link')); $i++) { array_push($links, $input['link'][$i]); } Note::create(['user' => Input::get('user'), 'note' => Input::get('note'), 'tbd' => Input::get('tbd'), 'link' => serialize($links)]); if (isset($input['image'])) { if (getimagesize($input['image']) != 0) { $ext = Input::file('image')->getClientOriginalExtension(); if (in_array($ext, $extensions)) { $image = file_get_contents($input['image']); Image::create(['image_name' => Input::file('image')->getClientOriginalName(), 'user' => Input::get('user'), 'image' => $image, 'ext' => $ext]); } else { return View::make('sessions.try_again'); } } else { return View::make('sessions.try_again'); } } return Redirect::route('home.index'); }
<?php require_once '../models/note.php'; require_once '../models/item.php'; require_once '../util/database.php'; if (isset($_SESSION['id'])) { $session_user_id = $_SESSION['id']; $note = new Note(); if (isset($_POST['note_content']) && rtrim($_POST['note_content']) != "") { $item = new Item(); $item_id = $_POST['item_id']; $content = rtrim($_POST['note_content']); $user_id = $item->getUserId('item_id', $item_id); $note->create($item_id, $user_id['user_id'], $content); $note->save(); } }
$key = array_shift($path); if (!$note->UID) { set_status(403, $STR["missing_uid"]); } /* Flippling switches */ switch ($method) { //Create a new note case "POST": if (!expect_parameters("title", "content", "private")) { set_status(403, $STR["missing_required_param"]); } else { $note->title = $data["title"]; $note->content = $data["content"]; $note->private = (bool) $data["private"]; $author_id = $SESSION_STARTED ? $CURRENT_USER->user_id : -1; $key = $note->create($author_id); set_status(201, $STR["note_created"]); $response["note"] = get_note_data($note); $response["note"]["key"] = $key; } break; //Fetch a note //Fetch a note case "GET": if ($note->fetch_data()) { $response["note"] = get_note_data($note); } else { set_status(404, $STR["note_404"]); } break; //Delete note from database
/** * Factory method to create a Contact object from an array * @param array $props - Associative array of initial properties to set * @return Contact */ public static function create(array $props) { $contact = new Contact(); $contact->id = parent::getValue($props, "id"); $contact->status = parent::getValue($props, "status"); $contact->first_name = parent::getValue($props, "first_name"); $contact->middle_name = parent::getValue($props, "middle_name"); $contact->last_name = parent::getValue($props, "last_name"); $contact->confirmed = parent::getValue($props, "confirmed"); $contact->source = parent::getValue($props, "source"); foreach ($props['email_addresses'] as $email_address) { $contact->email_addresses[] = EmailAddress::create($email_address); } $contact->prefix_name = parent::getValue($props, "prefix_name"); $contact->job_title = parent::getValue($props, "job_title"); foreach ($props['addresses'] as $address) { $contact->addresses[] = Address::create($address); } foreach ($props['notes'] as $note) { $contact->notes[] = Note::create($note); } $contact->company_name = parent::getValue($props, "company_name"); $contact->home_phone = parent::getValue($props, "home_phone"); $contact->work_phone = parent::getValue($props, "work_phone"); $contact->cell_phone = parent::getValue($props, "cell_phone"); $contact->fax = parent::getValue($props, "fax"); foreach ($props['custom_fields'] as $custom_field) { $contact->custom_fields[] = CustomField::create($custom_field); } foreach ($props['lists'] as $contact_list) { $contact->lists[] = ContactList::create($contact_list); } $contact->source_details = parent::getValue($props, "source_details"); return $contact; }
function addNote($vars, &$errors) { //Add ticket Id. $vars['ticketId'] = $this->getTicketId(); return Note::create($vars, $errors); }
function addNote($vars, &$errors) { //Add ticket Id. $vars['ticketId'] = $this->getTicketId(); // DELME: When HTML / rich-text is supported $vars['title'] = Format::htmlchars($vars['title']); $vars['note'] = Format::htmlchars($vars['note']); return Note::create($vars, $errors); }
public function saveComment() { $data = array(); if ($_POST['comment']) { try { $note = Note::create(array('ticketNumber' => $_POST['ticketNumber'], 'note' => $_POST['comment'])); $time = $note->getAttributes(); $note->save(); $data['time'] = $time["created_at"]; $data['comment'] = $_POST['comment']; } catch (Exception $e) { $response['info'] = "fail"; $boolean = false; echo $e; } } echo json_encode($data); }
/** * Store a newly created resource in storage. * POST /notes * * @return Response */ public function store() { Note::create(['note' => Input::get('note')]); return Response::json(array('success' => true)); }
function addNote($item_id, $user_id, $content) { $note = new Note(); $note->create($item_id, $user_id, $content); $note->save(); }