本文整理汇总了PHP中Note::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Note::create方法的具体用法?PHP Note::create怎么用?PHP Note::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Note
的用法示例。
在下文中一共展示了Note::create方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Note::create([]);
}
}
示例2: store
/**
* 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');
}
示例3: store
/**
* 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');
}
示例4: Note
<?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();
}
}
示例5:
$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
示例6: create
/**
* 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;
}
示例7: addNote
function addNote($vars, &$errors)
{
//Add ticket Id.
$vars['ticketId'] = $this->getTicketId();
return Note::create($vars, $errors);
}
示例8: addNote
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);
}
示例9: saveComment
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);
}
示例10: store
/**
* 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));
}
示例11: addNote
function addNote($item_id, $user_id, $content)
{
$note = new Note();
$note->create($item_id, $user_id, $content);
$note->save();
}