当前位置: 首页>>代码示例>>PHP>>正文


PHP Func::logAppActivity方法代码示例

本文整理汇总了PHP中Func::logAppActivity方法的典型用法代码示例。如果您正苦于以下问题:PHP Func::logAppActivity方法的具体用法?PHP Func::logAppActivity怎么用?PHP Func::logAppActivity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Func的用法示例。


在下文中一共展示了Func::logAppActivity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateNotifications

 public function updateNotifications($_activity_log)
 {
     \Func::logAppActivity();
     /*
                 *** activity log list ***
                 1. From Store
                 store_bookmark_store
                 destroy_bookmark_store
         2. From Post
                 -store_post
                 -update_post
                 destroy_post - need to take care
                 store_like_post
                 destroy_like_post
                 store_save_post
                 store_comment
                 store_like_comment
                 destroy_like_comment
                 destroy_comment
         3. From User
                 -update_user_profile_picture
                 -update_user
                 destroy_user
                 -update_user_password
                 -update_user_location
                 -update_user_about
                 -update_user_social_network
                 store_follow_user
                 destroy_follow_user
                 store_bookmark_group
                 update_bookmark_group
                 destroy_bookmark_group
                 store_post_group
                 update_post_group
                 destroy_post_group
                 store_follow_post_group
                 destroy_follow_post_group
                 store_save_group
                 update_save_group
                 destroy_save_group
                 store_follow_save_group
                 destroy_follow_save_group
     */
     switch ($_activity_log->action) {
         /* Store Starts */
         case "store_bookmark_store":
         case "destroy_bookmark_store":
             break;
             /* Store Ends, Post Starts */
         /* Store Ends, Post Starts */
         case "store_post":
         case "update_post":
             break;
         case "destroy_post":
             // need to modify
             if ($_activity_log->obj_type == "post") {
                 $notifications = $this->notification->where('obj_id', '=', $_activity_log->obj_id)->where('obj_type', '=', 'App\\Post')->get();
                 foreach ($notifications as $item) {
                     $item->delete();
                 }
             }
             break;
         case "store_like_post":
             if ($_activity_log->obj_type == "post") {
                 $post = $this->post->with('user', 'likesCount')->where('posts.id', '=', $_activity_log->obj_id)->first();
                 if ($post) {
                     if ($post->user_id == $_activity_log->user_id) {
                         break;
                     }
                     $likes = $this->like->with('user')->where('post_id', '=', $post->id)->orderBy('created_at', 'DESC')->get();
                     $content = "";
                     $counter = 0;
                     // Start
                     foreach ($likes as $item) {
                         if ($counter != 0) {
                             $content .= ", ";
                         }
                         $content .= "<a href=\"#/tab/account/" . $item->user->slug . "/notification\" onclick=\"event.stopPropagation();\">" . $item->user->first_name . " " . $item->user->last_name . "</a>";
                         if ($post->likesCount > 3) {
                             if ($counter >= 1) {
                                 $content .= " and " . ($post->likesCount - 2) . " more people";
                                 break;
                             }
                         }
                         $counter++;
                     }
                     $content .= " likes your post.";
                     // End
                     $notification = $this->notification->where('user_id', '=', $post->user_id)->where('obj_id', '=', $_activity_log->obj_id)->where('action', '=', "like_post")->where('obj_type', '=', 'App\\Post')->first();
                     if ($notification) {
                         $notification->delete();
                     }
                     $notification = $this->notification->firstOrCreate(['initiator_id' => \Auth::user()->id, 'user_id' => $post->user_id, 'target_src' => "/post/" . $post->id, 'action' => "like_post", 'obj_id' => $_activity_log->obj_id, 'obj_type' => "App\\Post"]);
                     $notification->contents = $content;
                     $notification->save();
                     $user = $this->user->where('id', '=', $post->user_id)->first();
                     \Func::sendPushNotification($user, strip_tags($content));
                 }
             }
             break;
//.........这里部分代码省略.........
开发者ID:bbig979,项目名称:shoppyst,代码行数:101,代码来源:CommonRepositoryEloquent.php


注:本文中的Func::logAppActivity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。