本文整理汇总了PHP中Message::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::find方法的具体用法?PHP Message::find怎么用?PHP Message::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
public function destroy($id)
{
$message = Message::find($id);
$this->deletePicture($message);
$message->delete();
return Redirect::route('admin');
}
示例2: check_message_rights
public static function check_message_rights($message_id)
{
$user = self::get_user_logged_in();
$message = new Message(Message::find($message_id));
$id = $message->user_id;
if ($user->userrole != 'ADMIN' && $user->id != $id) {
Redirect::to('/', array('message' => 'You have no authority to perform that action.'));
}
}
示例3: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$message = Message::find($id);
$message->fill(Input::all());
$message->save();
$material = Material::find(Input::get('materialid'));
$material->status = 'ok';
$material->save();
return Redirect::to('/beheer');
}
示例4: destroyMessage
public static function destroyMessage($id)
{
$message = new Message(Message::find($id));
$user_id = $message->user_id;
$thread_id = $message->thread_id;
$message->delete();
//Updating participants list
ForumUser::changePostAmount($user_id, $thread_id, -1);
Redirect::to('/thread/' . $message->thread_id, array('message' => 'Message deleted.'));
}
示例5: message
/**
* gets message regardless of the error state of this ValueTO.
* use this message ONLY WHEN valueTO is error.
*
* @return string|array
*/
public function message()
{
if (!$this->message) {
$type = $this->getType();
$method = $this->getErrorMethod();
$parameter = $this->getParameter();
$this->message = $this->messenger->find($type, $method, $parameter);
}
return $this->message;
}
示例6: actionEdit
public function actionEdit()
{
$languages = Message::getLanguages();
$model = new Message();
$model->language = $_GET['language'];
$model->file = $_GET['file'];
$model->messageId = $_GET['message-id'];
$model->message = Message::find($_GET['language'], $_GET['file'], $_GET['message-id']);
$files = Message::getFiles($_GET['language']);
$this->render('edit', array('languages' => $languages, 'files' => $files, 'language' => $model->language, 'file' => $model->file, 'message' => $model->message, 'messageId' => $model->messageId));
}
示例7: messageformAction
public function messageformAction($id = NULL, $nom, $nomfrm, $idFil)
{
$p = $this->getInstance($id);
$user = User::findFirst();
$message = Message::find("idProjet=" . $p->getId() . " AND idFil is NULL");
foreach ($message as $msg) {
$reponse = Message::find("idFil=" . $msg->getId());
}
$this->view->setVars(array("message" => $message, "reponse" => $reponse, "projet" => $p, "user" => $user, "nom" => $nom, "idFil" => $idFil, "nomfrm" => $nomfrm));
$this->jquery->postFormOnClick(".validate", "Messages/repondre", "frmAjoutMessage", "#divMessages");
$this->jquery->compile($this->view);
}
示例8: getMessages
/**
* retrieve the messages for this user and this page
*
* Does a query for the right messages
*
* @return Message data object with stream for messages
*
* @see MailboxAction::getMessages()
*/
function getMessages()
{
$message = new Message();
$message->from_profile = $this->user->id;
$message->orderBy('created DESC, id DESC');
$message->limit(($this->page - 1) * MESSAGES_PER_PAGE, MESSAGES_PER_PAGE + 1);
if ($message->find()) {
return $message;
} else {
return null;
}
}
示例9: deleteMessage
public function deleteMessage($message_id)
{
try {
$message = Message::find($message_id);
if ($message) {
$message->delete();
MessageState::where('message_id', '=', $message_id)->delete();
}
return true;
} catch (Exception $e) {
return false;
}
}
示例10: testHABTMRelation
public function testHABTMRelation()
{
$this->assertCount(2, User::first()->messages()->get());
User::first()->messages()->insert([['title' => 'sdf'], ['title' => '123123']]);
$this->assertCount(4, User::first()->messages()->get());
$this->assertCount(1, User::first()->messages()->get(['title'], ['sdf']));
$ids = User::last()->messages()->insert([['title' => 'new title']]);
$this->assertSame(4, User::first()->messages()->count());
$this->assertSame(1, User::last()->messages()->count());
$this->assertTrue(User::last()->messages()->has($ids[0]));
$this->assertTrue(User::last()->messages()->delete($ids[0]));
$this->assertFalse(User::last()->messages()->has($ids[0]));
$this->assertFalse(User::last()->messages()->has(Message::find($ids[0])));
// @todo test sync method
}
示例11: loadMessagesAction
public function loadMessagesAction($idProjet, $idFil = NULL)
{
$sql = "idProjet=" . $idProjet;
if ($idFil == null) {
$sql .= " AND idFil IS NULL";
} else {
$sql .= " AND idFil=" . $idFil;
}
$messages = Message::find($sql);
foreach ($messages as $msg) {
$reponses[$msg->getId()] = $responses = count(Message::find("idFil=" . $msg->getId()));
}
$this->view->setVars(array("messages" => $messages, "responses" => $responses));
$this->view->pick("messages/main");
}
示例12: loadMessagesAction
public function loadMessagesAction($idProjet, $idFil = NULL)
{
$sql = "idProjet=" . $idProjet;
if ($idFil == null) {
$sql .= " AND idFil IS NULL";
} else {
$sql .= " AND idFil=" . $idFil;
}
$messages = Message::find($sql);
$result = array();
foreach ($messages as $message) {
$responses = count(Message::find("idFil=" . $message->getId()));
array_push($result, array("id" => $message->getId(), "objet" => $message->getObjet(), "content" => $message->getContent(), "author" => $message->getUser()->__toString(), "responses" => $responses, "date" => $message->getSince()));
}
print_r(json_encode($result));
$this->view->disable();
}
示例13: projectAction
public function projectAction($id = NULL)
{
$p = Projet::findFirst("id=" . $id);
$user = User::findFirst("id=" . $p->getId());
//image a mettre
if ($p->getImage() == NULL) {
$source = "../../public/img/increase.png";
} else {
$source = $p->getImage();
}
$message = Message::find("idProjet=" . $p->getId() . " AND idFil is NULL");
$nbMsg = 0;
foreach ($message as $msg) {
$nbMsg = $nbMsg + 1;
}
$this->view->setVars(array("project" => $p, "user" => $user, "source" => $source, "nbMsg" => $nbMsg));
$this->jquery->get("Projects/equipe/" . $p->getId(), "#detailProject");
$this->jquery->click(".btnMessages", "\$('#divMessages').slideToggle('slow');");
$this->jquery->get("Projects/messages/" . $p->getId(), "#divMessages");
$this->jquery->compile($this->view);
}
示例14: actionView
public function actionView($mid = null)
{
if (defined('DISABLE_MESSAGING') && DISABLE_MESSAGING) {
throw new Lvc_Exception('Messaging disabled');
}
$active_user = User::require_active_user();
$this->setLayoutVar('active_user', $active_user);
$this->setLayoutVar('pageHead', 'Message');
$this->setLayoutVar('pageTitle', 'Message');
if (is_null($mid)) {
throw new Lvc_Exception('Null message id on view action');
}
if ($message = Message::find(array('mid' => $mid, 'user' => $active_user))) {
if ($message->to_user->uid = $active_user->uid) {
$message->mark_read();
}
$this->setVar('message', $message);
} else {
throw new Lvc_Exception('Message Not Found: ' . $mid);
}
}
示例15: indexAction
public function indexAction()
{
if ($this->request->isAjax()) {
// $name = $_POST['name'];
// $content = $_POST['content'];
// $name = $_REQUEST['name'];
// $content = $_REQUEST['content'];
$data = $_REQUEST;
// $data = [
// 'name' => $name,
// 'content' => $content
// ];
$result = json_decode((new \Message())->addList($data), true);
print_r($result);
die;
}
// $list = (new \Message())->getList();
// $this->view->setVar('list',$list);
$data = Message::find();
$page = (new \Message())->paging($data);
$this->view->setVar('page', $page);
}