Пример #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->statusForm->validate($request->all());
     $status = Status::fromForm($request);
     User::whoHas(Auth::user()->id)->publishStatus($status);
     flash()->success(trans('messages.status_title'), trans('messages.status_body'));
     return back();
 }
Пример #2
0
 /**
  * Confirm a user's email address.
  *
  * @param  string $token
  * @return mixed
  */
 public function confirmEmail($token)
 {
     User::whereToken($token)->firstOrFail()->confirmEmail();
     flash()->overlay(trans('messages.verified_email1'), trans('messages.verified_email2'), 'info');
     return redirect('auth/login');
 }
Пример #3
0
 /**
  * Leave new comment
  *
  * @param $input
  * @return static
  */
 public function leaveComment($input)
 {
     $comment = Comment::leave($input['body'], $input['status_id']);
     User::findOrFail($input['user_id'])->comments()->save($comment);
     return $comment;
 }
Пример #4
0
 /**
  * Handle the event.
  *
  * @param User $user
  * @internal param User $event
  */
 public function handle(User $user)
 {
     $user->inLine = false;
     $user->save();
 }
Пример #5
0
 /**
  * UnFollow a user
  *
  * @param $userToUnFollow
  * @param User $user
  * @return mixed
  */
 public function unFollow($userToUnFollow, User $user)
 {
     return $user->follows()->detach($userToUnFollow);
 }
 /**
  * Shared albums by other specific user with me
  *
  * @param User $otherUser
  * @return mixed
  */
 public function sharedAlbumsWithMe(User $otherUser)
 {
     $OtherUserAlbums = $otherUser->albums()->get();
     $albumsSharedWithMe = $this->albumsSharedWithMe()->get();
     return $OtherUserAlbums->intersect($albumsSharedWithMe);
 }
Пример #7
0
 /**
  * @param User $otherUser
  * @return bool
  */
 public function isFollowedBy(User $otherUser)
 {
     $idsWhoOtherUserFollows = $otherUser->follows()->lists('followed_id')->all();
     return in_array($this->id, $idsWhoOtherUserFollows);
 }
Пример #8
0
 /**
  * When unFollowing unShare all albums
  *
  * @param User $user
  * @param User $userSharingWithMe
  */
 public function unShareAllAlbums(User $user, User $userSharingWithMe)
 {
     $albumsToUnShare = $user->sharedAlbumsWithMe($userSharingWithMe)->lists('id')->all();
     $user->albumsSharedWithMe()->detach($albumsToUnShare);
 }