本文整理汇总了PHP中app\Notification::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::find方法的具体用法?PHP Notification::find怎么用?PHP Notification::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Notification
的用法示例。
在下文中一共展示了Notification::find方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: flag
public function flag(Request $request)
{
$notification = Notification::find($request->input('notification_id'));
$notification->flagged = true;
$notification->save();
return response()->json(['response' => 'success', 'notification' => $notification]);
}
示例2: open
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');
}
示例3: handle
/**
* 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);
}
示例4: received
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;
}
}
示例5:
<?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">
示例6: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$notification = Notification::find($id);
$notification->delete();
return 'deleted';
}
示例7: markAsRead
public static function markAsRead($notification_id)
{
$notification = Notification::find($notification_id);
$notification->is_read = 1;
$notification->save();
}
示例8: edit
/**
* 编辑消息
*
* @param int $id
* @return void
*/
public function edit($id)
{
return View::make('admin/notifications/edit')->with('notification', Notification::find($id));
}
示例9: deleteNotif
public function deleteNotif($idNotif)
{
$notif = Notification::find($idNotif);
$notif->seen = 1;
$notif->save();
}
示例10: postDelete
/**
* 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');
}
示例11: update
/**
* 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.');
}