本文整理汇总了PHP中Notification::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::where方法的具体用法?PHP Notification::where怎么用?PHP Notification::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notification
的用法示例。
在下文中一共展示了Notification::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteNotify
public function deleteNotify($id)
{
if (Notification::where('user_id', Auth::user()->id)->where('id', $id)->exists()) {
$noty = Notification::find($id);
$noty->delete();
}
}
示例2: ajax_notification
public function ajax_notification()
{
$notice = Notification::where('user_id', '=', Auth::user()->id)->where('is_read', '=', 0)->get();
foreach ($notice as $value) {
$value->is_read = 1;
$value->save();
}
}
示例3: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$notifications = Notification::where('show_from', '<', Carbon::now()->addMonth())->where('show_until', '>', Carbon::now()->subMonth())->orderby('important', 'desc')->orderby('updated_at', 'desc')->get();
// $notifications = Notification::where('show_from', '<', Carbon::now())->where('show_until', '>', Carbon::now())->orderby('important', 'desc')->orderby('updated_at', 'desc')->get();
$data['notifications'] = $notifications;
// return View::make('notifications.dashboard')->with($data);
return View::make('notifications.index')->with($data);
}
示例4: index
public function index()
{
$notifications = Notification::where('user', '=', Auth::User()->id)->orderBy('id', 'desc')->take(5)->get();
$count_notification = Notification::where('user', '=', Auth::User()->id)->where('read', '=', 0)->count();
$user_details = array('surname' => Auth::User()->surname, 'name' => Auth::User()->name, 'avatar' => Auth::User()->avatar);
$sidebar_adverts = DB::table('adverts')->join('advertisers', 'advertisers.id', '=', 'adverts.advertiser')->where('advertisers.id', '=', Auth::User()->advertiser)->select('adverts.name')->get();
return View::make('profile')->with('user', $user_details)->with('notifications', $notifications)->with('sidebar_adverts', $sidebar_adverts)->with('count_notification', $count_notification);
}
示例5: getNotifications
public function getNotifications()
{
$notifications = Notification::where('user_id', '=', Auth::user()->id)->get();
$validNotifications = Notification::getValidNotifications();
$selectedNotifications = [];
foreach ($notifications as $n) {
$selectedNotifications[] = $n->event;
}
return View::make('dashboard.notifications', compact('selectedNotifications', 'validNotifications'));
}
示例6: markread
public function markread(Request $request)
{
//$id = Auth::User()->id;
$id = 24;
$notifications = Notification::where('user_id', '=', $id)->get();
foreach ($notifications as $notification) {
$notification->is_read = 0;
$notification->save();
}
}
示例7: sysnotify
public function sysnotify()
{
if (!Auth::check()) {
Redirect::intended('/');
}
$notifications = Notification::where('type', '<>', 'new_reply')->where('user_id', '=', Auth::user()->id)->get();
$userID = Auth::user()->id;
$notifications->sysNotifyCount = Notification::WithNoType('new_reply')->ToWhom($userID)->count();
$notifications->repliesCount = Notification::WithType('new_reply')->ToWhom($userID)->count();
return View::make('account.notify', compact('notifications'));
}
示例8: getAdvert
public function getAdvert($advert)
{
$notifications = Notification::where('user', '=', Auth::User()->id)->orderBy('id', 'desc')->take(5)->get();
$count_notification = Notification::where('user', '=', Auth::User()->id)->where('read', '=', 0)->count();
$user_details = array('surname' => Auth::User()->surname, 'name' => Auth::User()->name, 'avatar' => Auth::User()->avatar);
$sidebar_adverts = DB::table('adverts')->join('advertisers', 'advertisers.id', '=', 'adverts.advertiser')->where('advertisers.id', '=', Auth::User()->advertiser)->select('adverts.name')->get();
// dd($adverts);
/*MAIN BODY CONTENT*/
$advert_id = DB::table('adverts')->where('name', '=', $advert)->select('id')->first();
$count_visits = DB::table('visits')->where('advert', '=', $advert_id->id)->sum('visits');
$deals = DB::table('deals')->where('advert', '=', $advert_id->id)->get();
$total_count_codes = 0;
$sold_count_codes = 0;
$remained_count_codes = 0;
$total_profit = 0;
$total_cooments = 0;
$deals_details = array();
$total_codes = 0;
$sold_codes = 0;
$remained_codes = 0;
$ccomments = 0;
if (count($deals) == 0) {
}
foreach ($deals as $key => $deal) {
$total_codes = DB::table('codes')->where('deal', '=', $deal->id)->get();
$sold_codes = DB::table('codes')->where('deal', '=', $deal->id)->where('available', '=', 0)->select('updated_at')->get();
$remained_codes = DB::table('codes')->where('deal', '=', $deal->id)->where('available', '=', 1)->select('updated_at')->get();
$ccomments = DB::table('comments')->where('deal', '=', $deal->id)->get();
$total_cooments = $total_cooments + count($ccomments);
$total_profit = $total_profit + $deal->price * count($sold_codes);
$total_count_codes = $total_count_codes + count($total_codes);
$sold_count_codes = $sold_count_codes + count($sold_codes);
$remained_count_codes = $remained_count_codes + count($remained_codes);
}
$coupons_status = array('total' => $total_count_codes, 'sold' => $sold_count_codes, 'remained' => $remained_count_codes, 'profit' => $total_profit, 'comments' => $total_cooments);
$deals_details[] = array('deals' => $deals, 'comments' => $ccomments, 'codes' => $total_codes);
//dd($s_coupons);
//dd($deals_details);
return View::make('index')->with('user', $user_details)->with('notifications', $notifications)->with('count_notification', $count_notification)->with('s_coupon_sold', $sold_codes)->with('visits', $count_visits)->with('coupons_status', $coupons_status)->with('deals_details', $deals_details)->with('sidebar_adverts', $sidebar_adverts);
}
示例9: putNotifications
/**
* API PUT Route to update a user's notification settings.
*
* @param User $user
*
* @return Response::json
*
* @todo There has to be a more efficient way to do this... We should probably only send changes from Angular. We can also separate the array matching into helper functions
*/
public function putNotifications(User $user)
{
if (Auth::user()->id !== $user->id) {
return Response::json($this->growlMessage("You do not have permissions to edit this user's notification settings", "error"));
}
//Grab notification array
$notifications = Input::get('notifications');
//Retrieve valid notification events
$validNotifications = Notification::getUserNotifications();
$events = array_keys($validNotifications);
//Loop through each notification
foreach ($notifications as $notification) {
//Ensure this is a known user event.
if (!in_array($notification['event'], $events)) {
return Response::json($this->growlMessage("Unable to save settings. Unknown event: " . $notification['event'], "error"));
}
//Grab this notification from the database
$model = Notification::where('user_id', '=', $user->id)->where('event', '=', $notification['event'])->first();
//If we don't want that notification (and it exists), delete it
if ($notification['selected'] === false) {
if (isset($model)) {
$model->delete();
}
} else {
//If the entry doesn't already exist, create it.
//Otherwise, ignore ( there was no change )
if (!isset($model)) {
$model = new Notification();
$model->user_id = $user->id;
$model->event = $notification['event'];
$model->type = "email";
$model->save();
}
}
}
return Response::json($this->growlMessage("Settings saved successfully.", "success"));
}
示例10: pull
public function pull()
{
if (!Auth::isLogged(App::$instance)) {
die(json_encode([]));
}
// not auth
//set time barrier
if (!$this->isCanBePulled()) {
die(json_encode([]));
}
// not time come
$startThere = date_create()->modify("-120 seconds");
$readed = $this->sesRead();
//define last access time
$this->putLastRequestTime();
//get notices
$notifications = Notification::where("created_at", ">", $startThere)->where("created_at", "<", date_create())->whereNotIn("id", $readed['filtered'])->whereIn("to", [0, App::$instance->user->id])->take(5)->get();
//humanize
if (count($notifications)) {
foreach ($notifications as $notice) {
$notice->humanized = new stdClass();
$notice->humanized->created_at = date_create($notice->created_at)->format("d.m.Y H:i:s");
}
}
//mark as collected
if (count($notifications)) {
foreach ($notifications as $notice) {
$readed['raw'][] = [$notice->id, date_create()->format("Y-m-d H:i:s")];
}
$this->sesWrite($readed['raw']);
}
if (ST::isAjaxRequest()) {
print json_encode($notifications);
} else {
return $notifications;
}
}
示例11: sendsms
public function sendsms()
{
foreach (Notification::where('status', 'peding')->get() as $send) {
}
}
示例12: numberOfUnreadMessages
public function numberOfUnreadMessages()
{
return count(Notification::where('user_id', '=', $this->id)->where('has_read', '=', '0')->get());
}
示例13: getNotificationList
public function getNotificationList()
{
$input = Input::all();
$user = Auth::user();
$notifications = Notification::where('user_id', $user['id'])->orderBy('id', 'DESC')->get();
$returnArray = array();
$i = 0;
foreach ($notifications as $notification) {
//print_r($notification->user_id);
$msg = "new message";
$filterImage = "filter-msg.png";
if ($notification->type == "newlike") {
$msg = "new like";
$filterImage = "filter-likes.png";
}
if ($notification->type == "newcomment") {
$msg = "new comment";
$filterImage = "filter-comments.png";
}
if ($notification->type == "newgroupmember") {
$msg = "new team member";
$filterImage = "filter-new-roller.png";
}
if ($notification->type == "missionpending") {
$msg = "mission pending";
}
$user = DB::select('select * from users where id = ?', array($notification->source_user_id));
if ($user) {
$returnArray[$i]['id'] = $notification->id;
$returnArray[$i]['user_id'] = $notification->user_id;
$returnArray[$i]['source_user_id'] = $notification->source_user_id;
$returnArray[$i]['type'] = $notification->type;
$returnArray[$i]['source_id'] = $notification->source_id;
$returnArray[$i]['message'] = $notification->message;
$returnArray[$i]['title'] = $msg;
$returnArray[$i]['filterImage'] = $filterImage;
$returnArray[$i]['isRead'] = $notification->isRead;
$returnArray[$i]['source_id'] = $notification->source_id;
$returnArray[$i]['updated_at'] = $notification->updated_at;
$returnArray[$i]['created_at'] = $notification->created_at;
$returnArray[$i]['type'] = $notification->type;
//$returnArray[$i]['userarray'] = $user;
$returnArray[$i]['src_user_pic'] = base64_decode($user[0]->picture);
$returnArray[$i]['username'] = $user[0]->firstname . " " . $user[0]->lastname;
//print_r(base64_decode($user[0]->picture));
}
DB::table('notifications')->where('id', $notification->id)->update(array('isRead' => 1));
$i++;
}
return $returnArray;
}
示例14: getNotifications
public function getNotifications()
{
$notifications = Notification::where('user_id', '=', Auth::user()->id)->get();
$validNotifications = Notification::getValidNotifications();
$selectedNotifications = [];
foreach ($notifications as $n) {
$selectedNotifications[] = $n->event;
}
return Response::json(compact('selectedNotifications', 'validNotifications'));
}
示例15: notifications
public function notifications()
{
// notifications that are about this project, its bids,
// or its collaborators.
$project = $this;
return Notification::where(function ($query) use($project) {
$query->where('payload_type', '=', 'bid');
$query->where_in('payload_id', $project->bids()->lists('id') ?: array(''));
})->or_where(function ($query) use($project) {
$query->where('payload_type', '=', 'project');
$query->where('payload_id', '=', $project->id);
})->get();
}