当前位置: 首页>>代码示例>>PHP>>正文


PHP Note::find方法代码示例

本文整理汇总了PHP中Note::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Note::find方法的具体用法?PHP Note::find怎么用?PHP Note::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Note的用法示例。


在下文中一共展示了Note::find方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $note = Note::find($id);
     $note->delete();
     Session::flash('message', 'Successfully deleted the Note you have selected!');
     return Redirect::to('notes');
 }
开发者ID:kimjay1,项目名称:noteweb,代码行数:13,代码来源:NoteController.php

示例2: hasSharesDebt

 public function hasSharesDebt($id = null)
 {
     $options = array('conditions' => array('Condo.' . $this->primaryKey => $id));
     $this->contain('Fraction');
     $condo = $this->find('first', $options);
     $fractions = Set::extract('/Fraction/id', $condo);
     $Note = new Note();
     return $hasSharesDebt = $Note->find('count', array('conditions' => array('Note.fraction_id' => $fractions, 'Note.note_type_id =' => 2, 'Note.note_status_id <' => 3, 'Note.document_date < NOW()')));
 }
开发者ID:cepedag14,项目名称:phkondo,代码行数:9,代码来源:Condo.php

示例3: createOrGetTags

 public static function createOrGetTags($tagsArray, $noteId, $noteUmask)
 {
     $tagsPublicPrefixCharacter = Config::get('paperwork.tagsPublicPrefixCharacter')[0];
     $createdOrFoundIds = array();
     if (is_null($tagsArray)) {
         return null;
     }
     $userId = Auth::user()->id;
     foreach ($tagsArray as $tagItem) {
         $tagTitle = '';
         $tagVisibility = 0;
         if ($tagItem[0] === $tagsPublicPrefixCharacter) {
             $tagTitle = strtolower(substr($tagItem, 1));
             $tagVisibility = 1;
             $tag = Tag::where('tags.title', '=', $tagTitle)->where('tags.visibility', '=', $tagVisibility)->first();
         } else {
             $tagTitle = strtolower($tagItem);
             $tagVisibility = 0;
             $tag = Tag::where('tags.title', '=', $tagTitle)->where('tags.visibility', '=', $tagVisibility)->where('tags.user_id', '=', $userId)->first();
         }
         // ->where('tags.title', '=', $tagTitle)
         // ->where('tags.visibility', '=', $tagVisibility)
         // ->select('tags.id')
         // ->first();
         if (is_null($tag) && ($tagVisibility == 0 || $tagVisibility == 1 && $noteUmask > PaperworkHelpers::UMASK_READONLY)) {
             $newTag = new Tag();
             $newTag->title = $tagTitle;
             $newTag->visibility = $tagVisibility;
             $newTag->user_id = $userId;
             $newTag->save();
             //$newTag->users()->attach(Auth::user()->id);
             $createdOrFoundIds[] = $newTag->id;
         } else {
             if ($tagVisibility == 0 || $tagVisibility == 1 && $noteUmask > PaperworkHelpers::UMASK_READONLY) {
                 /*if(is_null($tag->users()->where('users.id', '=', Auth::user()->id)->first())) {
                 			$tag->users()->attach(Auth::user()->id);
                 		}*/
                 $createdOrFoundIds[] = $tag->id;
             }
         }
     }
     //we need to add the other user's private tags to the list.
     $addtags = Note::find($noteId)->tags()->where('tags.visibility', '=', 0)->where('tags.user_id', '!=', $userId)->get();
     foreach ($addtags as $addtag) {
         $createdOrFoundIds[] = $addtag->id;
     }
     //if the user is not writer, he cannot change public tags.
     if ($noteUmask < PaperworkHelpers::UMASK_READWRITE) {
         $addpubtags = Note::find($noteId)->tags()->where('tags.visibility', '=', 1)->get();
         foreach ($addpubtags as $addtag) {
             $createdOrFoundIds[] = $addtag->id;
         }
     }
     return $createdOrFoundIds;
 }
开发者ID:jinchen891021,项目名称:paperwork,代码行数:55,代码来源:ApiTagsController.php

示例4: showeditcommentnote

 public function showeditcommentnote($id, $commentid)
 {
     $comment = Notecom::find($commentid);
     $note = Note::find($id);
     if (Auth::user()->id != $comment->collaborator_id) {
         if (Auth::user()->id != $note->user_id) {
             Session::flash('errorMessage', 'You are not authorized to edit this comment!');
             return Redirect::action('NotesController@show', array($id));
         }
     }
     return View::make('/collaboration/editcommentnote')->with('comment', $comment)->with('note', $note);
 }
开发者ID:betanotes,项目名称:betanotes.dev,代码行数:12,代码来源:CollaborationController.php

示例5: update

 public function update()
 {
     if (isset($this->params()->note['post_id'])) {
         $note = new Note(['post_id' => $this->params()->note['post_id']]);
     } else {
         $note = Note::find($this->params()->id);
     }
     if ($note->is_locked()) {
         $this->respond_to_error("Post is locked", array('post#show', 'id' => $note->post_id), ['status' => 422]);
         return;
     }
     $note->assignAttributes($this->params()->note);
     $note->user_id = current_user()->id;
     $note->ip_addr = $this->request()->remoteIp();
     # iTODO:
     if ($note->save()) {
         $this->respond_to_success("Note updated", '#index', ['api' => ['new_id' => $note->id, 'old_id' => (int) $this->params()->id, 'formatted_body' => $note->formatted_body()]]);
         // ActionController::Base.helpers.sanitize(note.formatted_body)]]);
     } else {
         $this->respond_to_error($note, ['post#show', 'id' => $note->post_id]);
     }
 }
开发者ID:JCQS04,项目名称:myimouto,代码行数:22,代码来源:NoteController.php

示例6: destroy

 public function destroy($id)
 {
     $note = Note::find($id);
     if (Auth::user()->id != $note->user_id) {
         Session::flash('errorMessage', 'You are not authorized to destroy this note!');
         return Redirect::action('NotesController@index');
     }
     $notescomments = DB::table('notecoms')->where('note_id', $id);
     $notescomments->delete();
     $note->delete();
     return Redirect::action('NotesController@index');
 }
开发者ID:betanotes,项目名称:betanotes.dev,代码行数:12,代码来源:NotesController.php

示例7: setNoteData

 private function setNoteData()
 {
     if (isset($this->phkRequestData['note_id']) && !isset($this->phkRequestData['note_text'])) {
         App::import("Model", "Note");
         $note = new Note();
         $result = $note->find("first", array('conditions' => array('Note.id' => $this->phkRequestData['note_id'])));
         if (count($result)) {
             $this->phkRequestData['note_id'] = $result['Note']['id'];
             $this->phkRequestData['note_text'] = $result['Note']['document'];
             $this->phkRequestData['owner_id'] = $result['Note']['entity_id'];
             $this->phkRequestData['fraction_id'] = $result['Note']['fraction_id'];
         }
     }
 }
开发者ID:phalkaline,项目名称:phkondo,代码行数:14,代码来源:AppController.php

示例8: destroy

 public function destroy($id)
 {
     $note = Note::find($id);
     $note->delete();
     return Response::json(['note' => $note, 'message' => 'Note Deleted']);
 }
开发者ID:kr4ckhe4d,项目名称:Laravel-IOSTutorial,代码行数:6,代码来源:NotesController.php

示例9: search

 public function search()
 {
     if (empty($_GET['query'])) {
         exit;
     }
     # TODO
     $config = Config::current();
     if ($config->clean_urls and substr_count($_SERVER['REQUEST_URI'], "?") and !substr_count($_SERVER['REQUEST_URI'], "%2F")) {
         # Searches with / and clean URLs = server 404
         redirect("search/" . urlencode($_GET['query']) . "/");
     }
     if (empty($_GET['query'])) {
         return Flash::warning(__("Please enter a search term."));
     }
     list($where, $params) = keywords($_GET['query'], "name LIKE :query OR url LIKE :query", "extensions");
     $extensions = Extension::find(array("placeholders" => true, "where" => $where, "params" => $params));
     list($where, $params) = keywords($_GET['query'], "description LIKE :query OR tags LIKE :query", "versions");
     $versions = Version::find(array("placeholders" => true, "where" => $where, "params" => $params));
     list($where, $params) = keywords($_GET['query'], "body LIKE :query", "notes");
     $notes = Note::find(array("placeholders" => true, "where" => $where, "params" => $params));
     $this->display("extend/search", array("extensions" => new Paginator($extensions, 25, "extensions_page"), "versions" => new Paginator($versions, 25, "versions_page"), "notes" => new Paginator($notes, 25, "notes_page"), "search" => $_GET['query']), fix(_f("Search results for \"%s\"", $_GET['query'])));
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:22,代码来源:controller.Extend.php

示例10: tagNote

 public function tagNote($notebookId, $noteId, $toTagId)
 {
     Note::find($noteId)->tags()->attach($toTagId);
     return PaperworkHelpers::apiResponse(PaperworkHelpers::STATUS_SUCCESS, $noteId);
 }
开发者ID:netesheng,项目名称:paperwork,代码行数:5,代码来源:ApiNotesController.php

示例11: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     //
     $extensions = array('jpg', 'gif');
     $links = array();
     $input = Input::all();
     for ($i = 0; $i < count(Input::get('link')); $i++) {
         array_push($links, $input['link'][$i]);
     }
     if (!empty($_POST['delete'])) {
         // Loop to store and display values of individual checked checkbox.
         foreach ($_POST['delete'] as $selected) {
             Image::whereId($selected)->delete();
         }
     }
     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');
         }
     }
     $note = Note::find($id);
     $note->note = Input::get('note');
     $note->tbd = Input::get('tbd');
     $note->link = serialize($links);
     $note->save();
     return Redirect::route('home.index');
 }
开发者ID:Kpatena,项目名称:notestomyself,代码行数:41,代码来源:HomeController.php

示例12: edit

 /**
  * Show the form for editing the specified note.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $note = Note::find($id);
     return View::make('notes.edit', compact('note'));
 }
开发者ID:waldenylson,项目名称:alfredapp,代码行数:11,代码来源:NotesController.php

示例13: required_params

<?php

required_params('note');
if (!empty(Request::$params->note['post_id'])) {
    $note = Note::blank(array('post_id' => Request::$params->note['post_id']));
} elseif (!empty(Request::$params->id)) {
    $note = Note::find(Request::$params->id);
}
if (!$note) {
    exit_with_status(400);
}
if ($note->is_locked()) {
    respond_to_error("Post is locked", array('post#show', 'id' => $note->post_id), array('status' => 422));
}
// $note->attributes = Request::$params->note;
$note->add_attributes(Request::$params->note);
$note->user_id = User::$current->id;
$note->ip_addr = Request::$remote_ip;
if ($note->save()) {
    respond_to_success("Note updated", '#index', array('api' => array('new_id' => $note->id, 'old_id' => (int) Request::$params->id, 'formatted_body' => $note->formatted_body())));
} else {
    respond_to_error($note, array('post#show', 'id' => $note->post_id));
}
开发者ID:laiello,项目名称:my-imouto-booru,代码行数:23,代码来源:update.php


注:本文中的Note::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。