本文整理汇总了PHP中Reply::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Reply::orderBy方法的具体用法?PHP Reply::orderBy怎么用?PHP Reply::orderBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reply
的用法示例。
在下文中一共展示了Reply::orderBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Reply
function _streamDirect($user_id, $offset = 0, $limit = NOTICES_PER_PAGE, $since_id = 0, $max_id = 0)
{
$reply = new Reply();
$reply->profile_id = $user_id;
if ($since_id != 0) {
$reply->whereAdd('notice_id > ' . $since_id);
}
if ($max_id != 0) {
$reply->whereAdd('notice_id <= ' . $max_id);
}
$reply->orderBy('notice_id DESC');
if (!is_null($offset)) {
$reply->limit($offset, $limit);
}
$ids = array();
if ($reply->find()) {
while ($reply->fetch()) {
$ids[] = $reply->notice_id;
}
}
return $ids;
}
示例2: post_replyticket
public function post_replyticket()
{
$postStr = Input::get('data');
parse_str($postStr, $post);
$validator = Validator::make(array('Reply' => $post['inputReplyTicket'], 'tid' => $post['tid']), array('Reply' => 'required', 'tid' => 'required|integer'), array('Reply.required' => 'Please enter a reply.', 'tid.required' => 'The system cannot find a ticket to reply to.', 'tid.integer' => 'The system has been sent an invalid ticket id to reply to.'));
//Verify some smart ass didn't try to change the hidden input field (tid) or reply to a closed ticket.
$count = Ticket::where('id', '=', $post['tid'])->where('vid', '=', Auth::user()->get()->cid)->where('status', '=', '1')->count();
if ($count == 0) {
//Damn them.
echo '<div class="alert alert-error"><li>Seriously? Nice try.</li></div>';
}
if ($validator->fails()) {
$messages = $validator->messages();
$errorStr = '';
foreach ($messages->all('<li>:message</li>') as $message) {
$errorStr .= '<div class="alert alert-error">' . $message . '</div>';
}
echo $errorStr;
} else {
$reply = new Reply();
$reply->tid = $post['tid'];
$reply->author = Auth::user()->get()->cid;
$reply->content = $post['inputReplyTicket'];
//Save our ticket update
$reply->save();
//Find or reply id
$reply = Reply::orderBy('updated_at', 'DESC')->first();
//Finally we need to update the updated_at field of our master ticket table
$ticket = Ticket::find($post['tid']);
$ticket->updated_at = $reply->updated_at;
//Save our ticket update
$ticket->save();
//Check to see if there is an assigned auditor. If so send them an email notification
if (!empty($ticket->assigned)) {
$data = array();
$auditor = ConsoleUser::find($ticket->assigned);
if (!empty($auditor)) {
$data['auditor'] = $auditor;
$data['subject'] = "VATSIM VA New Ticket Update";
if (!empty($auditor->email)) {
$body = "Hello " . ConsoleUser::getName($ticket->assigned) . ",<br /><br />There has been an update to your assigned ticket " . $ticket->subject . " by VA Administrator " . User::getFullName($ticket->vid) . ". <br /><br />" . $reply->content . "<br /><br /><br /> <strong>Do not reply to this email. If you wish to reply to this ticket, please do so through the auditor console.</strong>";
Mail::send('email.default', array("content" => $body), function ($message) use($data) {
$message->to($data['auditor']->email, $data['auditor']->name)->subject($data['subject']);
});
}
}
}
//Return 1 to inform the client this was successful.
echo '1';
}
}