本文整理汇总了PHP中Message::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::where方法的具体用法?PHP Message::where怎么用?PHP Message::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unreadInboxMessageAlert
public static function unreadInboxMessageAlert()
{
$new = Message::where('to', '=', Auth::user()->id)->where('checked', '=', 0)->where('type', '=', 1);
$data['count'] = $new->count();
$data['messages'] = $new->get()->toArray();
//tt($data);
return $data;
}
示例2: unreadInboxMessageAlert
public static function unreadInboxMessageAlert($type)
{
$new = Message::where('to', '=', Auth::user()->id)->where('checked', '=', 0)->where('type', '=', 1);
$data['count'] = $new->count();
if ($type === 'list' || $type === 'all') {
$data['messages'] = $new->get()->toArray();
}
return $data;
}
示例3: beheer
public function beheer()
{
if (Auth::check()) {
$messages = Message::where('status', '=', 'unsolved')->get();
return View::make('users.admin.beheer', ['messages' => $messages]);
} else {
return Redirect::to('/');
}
}
示例4: messageList
public function messageList()
{
if (Auth::user()->role == 1) {
$messages = Message::all();
return View::make('backend.user.messagelist')->with('data', $messages);
} elseif (Auth::user()->role == 2) {
$messages = Message::where('recipient_id', '=', Auth::user()->id)->orWhere('mass_message', '=', 1)->get();
return View::make('backend.user.messagelist')->with('data', $messages);
}
}
示例5: quickView
public function quickView($id)
{
$msg = Message::where('id', '=', $id);
$msgx = $msg->where('to', '=', Auth::user()->id)->get()->toArray();
$msgx = empty($msgx) ? tt('Access denied to this message') : $msgx[0];
//tt($msg->get()->toArray());
$msg->update(array('checked' => 1));
//tt($msg);
$data['msg'] = $msgx;
return View::make('quickview_messagealert', $data);
}
示例6: getUserMsg
public function getUserMsg($interlocutor_id)
{
$user_id = Auth::user()->id;
$messages = Message::where(function ($query) use($interlocutor_id, $user_id) {
$query->where('addressee_id', $interlocutor_id)->where('sender_id', $user_id);
})->orWhere(function ($query) use($interlocutor_id, $user_id) {
$query->where('addressee_id', $user_id)->where('sender_id', $interlocutor_id);
})->orderBy('created_at', 'desc')->paginate(20);
$interlocutor = array('id' => $interlocutor_id, 'name' => User::where('id', $interlocutor_id)->pluck('name'));
Message::where('addressee_id', $user_id)->where('sender_id', $interlocutor_id)->update(array('isread' => 1));
$view = array('messages' => $messages, 'addressee' => $interlocutor);
return View::make('user.msg.user-msg', $view);
}
示例7: infinite
public function infinite($chan, $direction, $id)
{
$channel = Channel::where('name', $chan)->firstOrFail();
$log = Message::findOrFail($id);
// Build the query to fetch logs with
if ($direction === 'up') {
$logs = Message::where('channel', $channel->sid)->where('ts', '<', "{$log->ts}")->orderBy('ts', 'desc')->take($this->ajaxLoad)->get();
} else {
$logs = Message::where('channel', $channel->sid)->where('ts', '>', "{$log->ts}")->orderBy('ts', 'asc')->take($this->ajaxLoad)->get();
}
$logs = Message\Repository::convertCollection($logs);
$loadMore = null;
if (count($logs) === $this->ajaxLoad) {
$loadMore = end($logs)->_id;
}
if ($direction === 'up') {
$logs = array_reverse($logs);
}
return View::make('partials.logs', compact('chan', 'logs'))->with('more' . $direction, $loadMore);
}
示例8: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($url, $key)
{
$fbua = ["facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)", "facebookexternalhit/1.1 (+https://www.facebook.com/externalhit_uatext.php)", "facebookexternalhit/1.0 (+http://www.facebook.com/externalhit_uatext.php)", "facebookexternalhit/1.0 (+https://www.facebook.com/externalhit_uatext.php)", "facebookexternalhit/1.2 (+http://www.facebook.com/externalhit_uatext.php)", "facebookexternalhit/1.2 (+https://www.facebook.com/externalhit_uatext.php)"];
if (in_array(Request::header('User-Agent'), $fbua)) {
return View::make('messages.show', ['body' => '']);
}
// Fetch our message
$msg = Message::where('url', '=', $url)->first();
if ($msg->destroyed) {
$body = "This message has been destroyed";
} else {
// Decrypt it
$iv = $msg->iv;
$body = mcrypt_decrypt(MCRYPT_BLOWFISH, $key, $msg->body, MCRYPT_MODE_CFB, $iv);
// Destroy the message
$msg->body = null;
$msg->destroyed = true;
$msg->save();
}
return View::make('messages.show', ['body' => $body]);
}
示例9: getIndex
public function getIndex()
{
$this->pusher = App::make('pusher');
$this->user = Auth::user();
$this->chatChannel = self::DEFAULT_CHAT_CHANNEL;
$this->friends = Enroll::getFriends(\Auth::user());
if (!$this->user) {
return redirect('auth/login');
}
if (!$this->friends) {
return redirect('/main');
}
if (\Input::get('friend')) {
$current_friend = \Input::get('friend');
} else {
$current_friend = $this->friends[0];
}
$messages = Message::where('from_user_id', '=', $this->user->id)->where('to_user_id', '=', $current_friend->id)->orWhere(function ($query) use($current_friend) {
$query->where('from_user_id', '=', $current_friend->id)->where('to_user_id', '=', $this->user->id);
})->get();
return view('chat', ['chatChannel' => $this->chatChannel, 'friends' => $this->friends, 'messages' => $messages, 'current_friend' => $current_friend]);
}
示例10: sentMessages
public function sentMessages()
{
$sentMessages = Message::where('from_user_id', Auth::user()->id)->orderBy('created_at', 'desc')->paginate(8);
return $sentMessages;
}
示例11: checkMsgTypeUsed
public function checkMsgTypeUsed($type_id)
{
$count = Message::where('type_id', '=', $type_id)->count();
if ($count > 0) {
return true;
} else {
return false;
}
}
示例12: showActu
public function showActu()
{
return View::make('actu')->with('position', Position::all())->with('messages', Message::where('active', '>', 0)->get());
}
示例13: sendMails
public function sendMails()
{
//gedeelte dat mails verstuurd wanneer er iets deffect of vermist is
$teachers = User::where('type', '=', 'teacher')->get();
$messages = Message::where('status', '=', 'unsolved')->where('mailsend', '=', false)->get();
if (!$messages->isEmpty()) {
Mail::send('emails.message', array('messages' => $messages), function ($message) use($teachers) {
foreach ($teachers as $teacher) {
$message->to($teacher->email, $teacher->lastname . ' ' . $teacher->firstname)->subject("Alle berichten van uitleendienst");
}
});
}
foreach ($messages as $message) {
$message->mailsend = true;
$message->save();
}
//gedeelte dat studenten op de hoogt brengt wanneer hun materiaal nog niet binnen is wanneer iemand anders zijn reservatie start
// de gebruikers + details van reservatie waarvan het materiaal nog niet binnen is of het gebroken of vermist is
$usersMaterialNotAvailable = $this->reservation->checkMaterialAvailable();
if (!empty($usersMaterialNotAvailable)) {
foreach ($usersMaterialNotAvailable as $reservation) {
Mail::send('emails.notavailable', array('reservation' => $reservation), function ($message) use($reservation) {
$message->to($reservation->email, $reservation->lastname . ' ' . $reservation->firstname)->subject('materiaal voor reservatie niet binnen');
});
}
}
// gedeelte waarbij student op de hoogte word gebracht wanneer materiaal niet binnen is na de opgegeven eind tijd
$usersMaterialBringback = $this->reservation->checkMaterialBroughtBack();
if (!empty($usersMaterialBringback)) {
foreach ($usersMaterialBringback as $reservation) {
Mail::send('emails.bringBack', array('reservation' => $reservation), function ($message) use($reservation) {
$message->to($reservation->email, $reservation->lastname . ' ' . $reservation->firstname)->subject('materiaal voor reservatie niet binnen gebracht');
});
}
}
}
示例14: textSearch
public static function textSearch(\Channel $channel, $q)
{
$results = \Message::where('channel', $channel->sid)->where('text', 'like', "%{$q}%")->take(static::$downLimit + static::$upLimit)->orderBy('ts', 'desc')->get();
return static::convertCollection($results);
}
示例15: deleteUser
public function deleteUser()
{
$id = Input::get('userId');
$test_user = DB::table('admin_option')->where('option_name', 'Test User Emails')->select('option_value')->get();
if (!empty($test_user)) {
$count = 0;
foreach ($test_user as $value) {
foreach (explode(',', $value->option_value) as $test_user_id) {
if ($id == $test_user_id) {
$count = $count + 1;
}
}
}
} else {
$count = 0;
}
if ($count > 0) {
$connections = Connection::Where('user_id', '=', $id)->first();
if (!empty($connections)) {
$connections->user_id = null;
$connections->save();
}
$deletekarmanote = Karmanote::where('user_idreceiver', '=', $id)->delete();
$deletekarmanote = Karmanote::where('user_idgiver', '=', $id)->delete();
$deleterequest = Meetingrequest::where('user_id_receiver', '=', $id)->delete();
$deletekarmanote = Meetingrequest::where('user_id_giver', '=', $id)->delete();
$deletekarmanote = Meetingrequest::where('user_id_introducer', '=', $id)->delete();
$deleteusergroups = Usersgroup::where('user_id', '=', $id)->delete();
$findquestion = Question::Where('user_id', '=', $id)->get();
if (!empty($findquestion)) {
foreach ($findquestion as $val) {
$question_id = $val->id;
$findgroupquestion = Groupquestion::Where('question_id', '=', $question_id)->get();
if (!empty($findgroupquestion)) {
$deletegroupquestion = Groupquestion::Where('question_id', '=', $question_id)->delete();
}
$findQuestionwillingtohelp = Questionwillingtohelp::Where('question_id', '=', $question_id)->get();
if (!empty($findQuestionwillingtohelp)) {
$deleteQuestionwillingtohelp = Questionwillingtohelp::Where('question_id', '=', $question_id)->delete();
}
}
}
$deleteQuestionwillingtohelp = Questionwillingtohelp::Where('user_id', '=', $id)->delete();
if (!empty($findquestion)) {
$deletequestion = Question::where('user_id', '=', $id)->delete();
}
$deletekarmacircles = Karmacircle::where('user_id', '=', $id)->delete();
$deletekarmaFeed = Karmafeed::where('receiver_id', '=', $id)->orWhere('giver_id', '=', $id)->delete();
$userMykarmaDelete = Mykarma::where('user_id', '=', $id)->delete();
$userMessageDelete = Message::where('receiver_id', '=', $id)->orWhere('giver_id', '=', $id)->delete();
$getIntroDataDelete = KarmaIntro::where('intro_giver_id', '=', $id)->orWhere('intro_receiver_id', '=', $id)->orWhere('intro_introducer_id', '=', $id)->delete();
$getMyKarmaDataDelete = Mykarma::where('user_id', '=', $id)->delete();
$user = User::find($id);
$user->delete();
echo "User " . $id . " deleted";
} else {
echo "User " . $id . " cant be deleted.Its not a test user.";
}
}