Example #1
0
 public function followUser($user, $to_follow_uuid)
 {
     if ($this->getUserFollowstatus($user, $to_follow_uuid) == 0) {
         $uf = new Users_follow();
         $uf->uuid = $user;
         $uf->follow_type = 2;
         $uf->obj_id = $to_follow_uuid;
         $uf->save();
         $notification = new Notification();
         $notification->store(2, $to_follow_uuid, $user, 'follow');
         event(new \App\Events\FollowUserEvent($user, $to_follow_uuid));
         return 1;
     } else {
         DB::table('users_follow')->where('uuid', $user)->where('obj_id', $to_follow_uuid)->delete();
         DB::table('notification')->where('recipient', $to_follow_uuid)->where('sender', $user)->delete();
         return 0;
     }
 }
Example #2
0
 public function follow_cate(Request $request)
 {
     if (Auth::user()) {
         $uf = new Users_follow();
         return $uf->followFeed(Auth::user()->uuid, $request->data);
     } else {
         echo "unauthorized";
     }
 }
Example #3
0
 /**
  * Show the application dashboard.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $categories = Categories::all();
     $user = User::find(Auth::user()->id);
     /*echo $user;
       echo $user->uuid;*/
     if (empty($user->displayname)) {
         return redirect()->action('ProfileController@createName');
     }
     $followFeed = new Users_follow();
     $topics = $followFeed->getFeed(Auth::user()->uuid);
     //        print_r($topics);
     return view('home', compact('categories', 'topics'));
 }