public function flag(Request $request) { $notification = Notification::find($request->input('notification_id')); $notification->flagged = true; $notification->save(); return response()->json(['response' => 'success', 'notification' => $notification]); }
public function open($id) { $notification = Notification::find($id); $notification->seen = 1; $notification->save(); $notifications = \Auth::user()->notifications()->where('seen', '0')->get(); if (count($notifications) == 0) { return response()->json('empty'); } return response()->json('success'); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $notification_id = $request->query('notification'); if ($notification_id) { if (Auth::check()) { $user = Auth::user(); $notification = Notification::find($notification_id); if ($notification->user_id == $user->id) { $notification->is_read = true; $notification->save(); } } } return $next($request); }
public function received($id) { $handle = Notification::find($id); $handle->is_read = 1; $handle->save(); switch ($handle->type) { case 'message': return redirect('/messages/' . $handle->getObject()->id); break; case 'friend_invite': return redirect(url('/user/' . $handle->getObject()->id)); break; case 'post': return redirect('/post/' . $handle->getObject()->id); break; case 'comment': return redirect('/post/' . $handle->getObject()->id); default: print_r($handle->type); break; } }
<?php use App\User; use App\Worker; use App\Branch; use App\UserLevel; use App\Notification; use App\Provider; use App\ProviderBill; use App\ProviderBillBreakdown; use App\Stock; $currentNotification = Notification::find($notification); $currentNotification->Seen = true; $currentNotification->save(); $permissions = json_decode(UserLevel::find(Auth::user()->UserLevel)->Permissions); $provider = Provider::find($pId); $bill = ProviderBill::where('ProviderId', '=', $pId)->where('BillNumber', '=', $bill)->first(); $billBreakdown = ProviderBillBreakdown::where('ProviderBillId', '=', $bill->Id)->get(); $worker = Worker::find(Auth::user()->TypeId); $total = 0; ?> <!DOCTYPE html> <html lang="es"> <head> <title>Eirene Systema Administrativo</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta charset="UTF-8"> <meta name="csrf-token" content="{{{ Session::token() }}}"> <link href="{{ URL::to('/') }}/css/bootstrap.min.css" rel="stylesheet"> <link href="{{ URL::to('/') }}/css/bootstrap-responsive.min.css" rel="stylesheet">
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $notification = Notification::find($id); $notification->delete(); return 'deleted'; }
public static function markAsRead($notification_id) { $notification = Notification::find($notification_id); $notification->is_read = 1; $notification->save(); }
/** * 编辑消息 * * @param int $id * @return void */ public function edit($id) { return View::make('admin/notifications/edit')->with('notification', Notification::find($id)); }
public function deleteNotif($idNotif) { $notif = Notification::find($idNotif); $notif->seen = 1; $notif->save(); }
/** * Remove the specified resource from storage. * * @param $Notification * @return Response */ public function postDelete(DeleteRequest $request, $id) { $notification = Notification::find($id); $notification->delete(); return redirect('admin/notifications'); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id, Request $request, NotificationRequest $notificationRequest) { // $fields = $request->except('optionsRadios', 'email'); $notification = Notification::find($id); if (!isset($fields['user_id'])) { $fields['user_id'] = NULL; } if (!isset($fields['role_id'])) { $fields['role_id'] = NULL; } if ($request->get('email') == 1) { if (strcmp($request->get('optionsRadios'), "users") == 0) { $user_id = $request->get('user_id'); $user = User::findOrFail($user_id); Mail::send('emails.notification', ['user' => $user, 'fields' => $fields], function ($m) use($user, $fields) { $m->to($user->email)->subject('Usted tiene una nueva notificación ' . $fields['title']); }); } else { $role_id = $request->get('role_id'); $role = Sentinel::findRoleById($role_id); $users = $role->users()->with('roles')->get(); foreach ($users as $user) { Mail::send('emails.notification', ['user' => $user, 'fields' => $fields], function ($m) use($user, $fields) { $m->to($user->email)->subject('Usted tiene una nueva notificación ' . $fields['title']); }); } } } $notification->fill($fields); $notification->save(); return \Redirect::to('notifications')->withSuccess('La notificación se ha sido actualizado.'); }