本文整理汇总了PHP中app\Notification类的典型用法代码示例。如果您正苦于以下问题:PHP Notification类的具体用法?PHP Notification怎么用?PHP Notification使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Notification类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$notify_report = false;
for ($i = 0; $i < count($request->all()); $i++) {
if ($request->input($i . '.include')) {
$this->validate($request, [$i . '.id' => 'required', $i . '.member.id' => 'required|numeric', $i . '.position_id' => 'required|numeric', $i . '.project_id' => 'required|numeric', $i . '.target_id' => 'required|numeric', $i . '.output' => 'required|numeric', $i . '.date_start' => 'required|date', $i . '.date_end' => 'required|date', $i . '.hours_worked' => 'required|numeric', $i . '.daily_work_hours' => 'required|numeric', $i . '.output_error' => 'required|numeric']);
// check if a report is already created
if (!$notify_report) {
$admin = User::where('role', 'admin')->first();
$report = Report::where('id', $request->input($i . '.report_id'))->first();
// create a notification
$notification = new Notification();
$notification->message = 'updated a ';
$notification->sender_user_id = $request->user()->id;
$notification->receiver_user_id = $admin->id;
$notification->subscriber = 'admin';
$notification->state = 'main.weekly-report';
$notification->event_id = $report->id;
$notification->event_id_type = 'report_id';
$notification->seen = false;
$notification->save();
$notify = DB::table('reports')->join('users', 'users.id', '=', 'reports.user_id')->join('projects', 'projects.id', '=', 'reports.project_id')->join('notifications', 'notifications.event_id', '=', 'reports.id')->select('reports.*', 'users.*', DB::raw('LEFT(users.first_name, 1) as first_letter'), 'projects.*', 'notifications.*')->where('notifications.id', $notification->id)->first();
// foreach ($query as $key => $value) {
// $notify = $value;
// }
event(new ReportSubmittedBroadCast($notify));
$activity_type = ActivityType::where('action', 'update')->first();
$activity = new Activity();
$activity->report_id = $report->id;
$activity->user_id = $request->user()->id;
$activity->activity_type_id = $activity_type->id;
$activity->save();
// report
$create_report = true;
}
$old_performance = Performance::where('id', $request->input($i . '.id'))->first();
// record history of the performance
$performance_history = new PerformanceHistory();
$performance_history->activity_id = $activity->id;
$performance_history->performance_id = $old_performance->id;
$performance_history->report_id = $old_performance->report_id;
$performance_history->member_id = $old_performance->member_id;
$performance_history->position_id = $old_performance->position_id;
$performance_history->department_id = $old_performance->department_id;
$performance_history->project_id = $old_performance->project_id;
$performance_history->target_id = $old_performance->target_id;
$performance_history->date_start = $old_performance->date_start;
$performance_history->date_end = $old_performance->date_end;
$performance_history->daily_work_hours = $old_performance->daily_work_hours;
$performance_history->output = $old_performance->output;
$performance_history->hours_worked = $old_performance->hours_worked;
$performance_history->output_error = $old_performance->output_error;
$performance_history->average_output = $old_performance->average_output;
$performance_history->productivity = $old_performance->productivity;
$performance_history->quality = $old_performance->quality;
$performance_history->quadrant = $old_performance->quadrant;
$performance_history->save();
}
}
}
开发者ID:mcoyevans,项目名称:personiv-productivity-quality-report,代码行数:66,代码来源:PerformanceHistoryController.php
示例2: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$notification = $this->notification->where('slug', $this->argument('notification'))->first();
if (!$notification) {
$this->error('Invalid notification provided.');
return 1;
}
$users = $notification->subscribers;
if (!count($users)) {
$this->error('No subscribers to send to!');
return 1;
}
if (method_exists($this, $notification->slug)) {
$users = $this->{$notification->slug}($users);
}
if ($this->option('pretend')) {
$this->info('Notification ' . $notification->name . ' would be sent to the following subscribers:');
foreach ($users as $user) {
$this->line($user->name . ' <' . $user->email . '>');
}
return 0;
}
foreach ($users as $user) {
Mail::queue('emails.notifications.' . $notification->template, ['user' => $user], function ($message) use($user, $notification) {
$message->to($user->email, $user->name);
$message->subject($notification->subject);
});
$this->info('Queued notification for ' . $user->name . ' <' . $user->email . '>');
}
return 0;
}
开发者ID:Cheddam,项目名称:health,代码行数:36,代码来源:SendNotification.php
示例3: __construct
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($topic_uuid, $topics_uid, TopicReply $data)
{
$notification = new Notification();
$this->count = $notification->countNotification($topics_uid);
$this->author = $topics_uid;
$this->topic = $topic_uuid;
$this->data = $data;
}
开发者ID:ktardthong,项目名称:qanya,代码行数:13,代码来源:TopicReplyEvent.php
示例4: addNtf
public function addNtf()
{
$notification = new Notification();
$notification->message = 'test';
$notification->cron = '* * * * * *';
$notification->receiver_id = 1;
$notification->save();
return "added";
}
开发者ID:dzikimarian,项目名称:hipchat-reminder,代码行数:9,代码来源:NotificationsController.php
示例5: sentMessageNotification
public function sentMessageNotification($user)
{
$sender = User::findOrFail(Auth::user()->id);
$notification = new Notification();
$notification->user_id = $user->id;
$notification->title = 'You have a new message!!';
$notification->body = $sender->name . ' has sent you a private message! Go to your inbox to reply now!';
$notification->save();
}
开发者ID:mathewsandi,项目名称:Practice,代码行数:9,代码来源:MessageRepository.php
示例6: handle
/**
* Handle the event.
*
* @param BadgeWasEarned $event
* @return void
*/
public function handle(BadgeWasEarned $event)
{
$user = $event->user;
$notification = new Notification();
$notification->type = "Badge";
$notification->is_read = false;
$notification->user_id = $user->id;
$notification->save();
}
开发者ID:Clazance,项目名称:developer-shame,代码行数:15,代码来源:SendBadgeNotification.php
示例7: addConnectionNotification
public function addConnectionNotification($friend)
{
$sender = User::findOrFail(Auth::user()->id);
$notification = new Notification();
$notification->user_id = $friend->id;
$notification->title = 'Someone has added you as their connection!';
$notification->body = $sender->name . ' added you to their connection list, add them back to interact with them if you have not done so already!';
$notification->save();
}
开发者ID:mathewsandi,项目名称:Practice,代码行数:9,代码来源:UserRepository.php
示例8: __construct
/**
* Create a new event instance.
*
* @return void
*
* $flg -> increment or decrement
*/
public function __construct($notify_user, $topics_uuid, $is_upvote)
{
$this->user = $notify_user;
$notification = new Notification();
$this->count = $notification->countNotification($notify_user);
$this->is_upvote = $is_upvote;
//Get the most upvote count*/
$tp = new Topic();
$this->upv_cnt = $tp->upvoteTopic($topics_uuid, $is_upvote);
$this->topic = $topics_uuid;
}
开发者ID:ktardthong,项目名称:qanya,代码行数:18,代码来源:TopicUpvote.php
示例9: testNotificationDelete
public function testNotificationDelete()
{
$admin = User::find(1);
$notification = new Notification();
$notification->title = "Test title 123";
$notification->type = "Alarm test";
$notification->notes = "Test property ";
$notification->data = "Test data ";
$notification->save();
$savedNotification = Notification::where('title', '=', 'Test title 123')->first();
$this->actingAs($admin)->withSession(['foo' => 'bar'])->visit($this->modelUrl . (string) $savedNotification->id)->press('Delete')->seePageIs($this->modelUrl);
}
开发者ID:Tanprasit,项目名称:property-management-system-web,代码行数:12,代码来源:NotificationsTest.php
示例10: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
$this->validate($request, ['body' => 'required|min:5']);
if ($request->user()->muted) {
return \Redirect::back()->with('error', 'You are muted.');
}
$status = ['body' => $request->body];
$st = $this->status->publish($status);
// Create notification with Stream
$not = new Notification();
$not->from($request->user())->withType('UserStatusUpdate')->withSubject('A status is posted')->withBody(link_to_route('user.show', $request->user()->displayName(), $request->user()->username) . " published a post in his feedline " . link_to_route('show-status', "#" . $st->id, $st->id))->withStream(true)->regarding($st)->deliver();
return \Redirect::back()->with('message', 'Status updated successfully');
}
开发者ID:kinnngg,项目名称:knightofsorrow,代码行数:19,代码来源:StatusController.php
示例11: handle
/**
* Handle the event.
*
* @param ShameWasUpdated $event
* @return void
*/
public function handle(ShameWasUpdated $event)
{
$shame = $event->shame;
$users = $shame->follows;
foreach ($users as $user) {
$notification = new Notification();
$notification->type = "Shame";
$notification->is_read = false;
$notification->user_id = $user->id;
$notification->shame_id = $shame->id;
$notification->save();
}
}
开发者ID:Clazance,项目名称:developer-shame,代码行数:19,代码来源:SendShameNotification.php
示例12: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
//
$notification = new Notification();
if (Request::has('text') && Request::input('text') != "") {
$notification->text = Request::input('text');
$notification->save();
return Response::make("Success", 201);
} else {
// Bad request, missing parameters
return Response::make("Please provide a notification.", 400);
}
}
开发者ID:BrynnLawson,项目名称:smarka,代码行数:18,代码来源:NotificationsController.php
示例13: handle
/**
* Handle the event.
*
* @param CommentWasAdded $event
* @return void
*/
public function handle(CommentWasAdded $event)
{
$comment = $event->comment;
$shame = $comment->shame;
$users = $shame->follows;
foreach ($users as $user) {
$notification = new Notification();
$notification->type = "Comment";
$notification->is_read = false;
$notification->user_id = $user->id;
$notification->shame_id = $shame->id;
$notification->comment_id = $comment->id;
$notification->save();
}
}
开发者ID:Clazance,项目名称:developer-shame,代码行数:21,代码来源:SendCommentNotification.php
示例14: store
/**
* Store a newly created resource in storage.
*
* @param NewsRequest $request
* @return Response
*/
public function store(NewsRequest $request)
{
$slug = str_limit(str_slug($request->title), 50) . "--author-{$request->user()->username}";
/*$news = News::where('summary',$slug)->first();
if($news)
{
$slug = str_limit(str_slug($request->title),50)."-".time()."--author-{$request->user()->username}";
}*/
$news = $request->user()->news()->create(['title' => $request->title, 'text' => $request->text, 'summary' => $slug, 'is_published' => true, 'news_type' => $request->news_type]);
// Create notification
$not = new Notification();
$not->from($request->user())->withType('NewsCreated')->withSubject('A news is created')->withBody(link_to_route('user.show', $request->user()->displayName(), $request->user()->username) . " has created a news " . link_to_route('news.show', str_limit($news->title, 100), $news->summary))->withStream(true)->regarding($news)->deliver();
return redirect()->route('news.show', $news->summary)->with('message', 'News Created');
}
开发者ID:kinnngg,项目名称:knightofsorrow,代码行数:21,代码来源:NewsController.php
示例15: saveNotification
public function saveNotification($data)
{
$notify = new Notification();
$notification_responce_time = '30';
$time = date('Y-m-d H:i:s');
$newtime = strtotime("{$time} + {$notification_responce_time} seconds");
$expire = date('Y-m-d H:i:s', $newtime);
$notify->sender_id = $data['sender_id'];
$notify->reciver_id = $data['reciver_id'];
$notify->message = $data['message'];
$notify->type = $data['type'];
$notify->expired_at = $expire;
$notify->save();
return $notify;
}
开发者ID:abhiyadav001,项目名称:Lion,代码行数:15,代码来源:Notification.php
示例16: notification
/**
* @return \Illuminate\View\View
*/
public function notification()
{
//Fetch all notifications for this user alone
$notifications = Notification::where('user_id', auth()->user()->id)->paginate(10);
$data = ['notifications' => $notifications];
return view('frontend.user.notification', $data);
}
开发者ID:carlosqueiroz,项目名称:laravel-hospital-record-system,代码行数:10,代码来源:UserController.php
示例17: storeForTournament
public function storeForTournament($id, Request $request)
{
$t = KTournament::findOrFail($id);
$comment = \Input::get('body');
if ($comment == '') {
return \Redirect::back();
}
if ($request->user()->muted) {
return \Redirect::back()->with('error', 'You are muted.');
}
$t->comments()->create(['body' => $comment, 'user_id' => Auth::user()->id]);
// Create notification
$not = new Notification();
$not->from($request->user())->withType('UserCommentOnTournament')->withSubject('A comment is done on tournament')->withBody(link_to_route('user.show', $request->user()->displayName(), $request->user()->username) . " has commented on " . link_to_route('tournament.show', $t->name, $t->slug) . " tournament")->withStream(true)->regarding($t)->deliver();
return \Redirect::back()->with('success', 'Success!');
}
开发者ID:kinnngg,项目名称:knightofsorrow,代码行数:16,代码来源:CommentController.php
示例18: handle
/**
* Handle the event.
*
* @param Events $event
* @return void
*/
public function handle(NotifiableEvent $event)
{
$notification = Notification::create($event->getData());
$notification->notifiable()->associate($event->getNotifiable());
$notification->save();
$event->getUser()->notifications()->save($notification);
}
开发者ID:bluecipherz,项目名称:bczapi,代码行数:13,代码来源:NotifyUser.php
示例19: index
public function index()
{
$logged_user_id = Auth::user()->id;
$users = User::find($logged_user_id);
$notification = Notification::where('user_id', $logged_user_id)->orderBy('created_at', 'desc')->paginate(5);
return View::make('notification')->with('users', $users)->with('notification', $notification);
}
开发者ID:sagaekakristi,项目名称:ppla02,代码行数:7,代码来源:NotificationController.php
示例20: notifications
public function notifications(View $view)
{
//Fetch all notifications for this user alone
$notifications = Notification::where('user_id', auth()->user()->id)->paginate(3);
$data = ['notifications' => $notifications];
$view->with($data);
}
开发者ID:carlosqueiroz,项目名称:laravel-hospital-record-system,代码行数:7,代码来源:DoctorComposer.php
注:本文中的app\Notification类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论