Beispiel #1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //$member = Member::find($id);
     $profileUser = User::where('slug', $id)->first();
     $member = Member::where('user_id', $profileUser->id)->first();
     $user = Auth::user();
     $isMemberProfile = false;
     $isFollowing = false;
     $showWelcomeMessage = false;
     if (Auth::check()) {
         if ($member->user_id == Auth::User()->id) {
             $isMemberProfile = true;
             if (!$user->welcomed) {
                 $showWelcomeMessage = true;
                 $user->welcomed = true;
                 $user->save();
             }
         }
         if (Follower::where('user_id', $member->user->id)->where('follower_id', $user->id)->count()) {
             $isFollowing = true;
         }
     }
     $artists = Artist::where('verified', true)->orderBy('firstname', 'asc')->get();
     $categories = Tag::where('isCategory', true)->get();
     return view('pages.member', ['member' => $member, 'isMemberProfile' => $isMemberProfile, 'isFollowing' => $isFollowing, 'artists' => $artists, 'categories' => $categories, 'showWelcomeMessage' => $showWelcomeMessage]);
 }
Beispiel #2
0
 public function followersUnfollow()
 {
     $requestFollower = Request::all();
     $user_id = $requestFollower['user_id'];
     $follow_id = $requestFollower['follow_id'];
     Follower::where('user_id', '=', $user_id)->where('follow_id', '=', $follow_id)->delete();
     return 'Success';
 }
Beispiel #3
0
 public function newsfeed($pagination = 100)
 {
     return Follower::select('tweets.user_id', 'users.name', 'users.username', 'tweets.message', 'tweets.created_at', 'tweets.updated_at')->join('tweets', 'followers.user_id', '=', 'tweets.user_id')->join('users', 'followers.user_id', '=', 'users.id')->where('followers.follower_id', $this->id)->orWhere('followers.user_id', $this->id)->orderBy('tweets.created_at', 'asc')->distinct('tweets.id')->paginate($pagination);
 }
Beispiel #4
0
 /**
  * Get the artists in the studio
  *
  */
 public function artists($id)
 {
     $studio = Studio::find($id);
     if ($studio) {
         $studio->cover = url('uploads/images/large/' . $studio->cover);
         $user = Auth::user();
         $isArtistProfile = false;
         $isFollowing = false;
         if (Auth::check()) {
             if ($studio->user_id == Auth::User()->id) {
                 $isArtistProfile = true;
             }
             if (Follower::where('user_id', $studio->user->id)->where('follower_id', $user->id)->count()) {
                 $isFollowing = true;
             }
         }
         if (filter_var($studio->user->avatar, FILTER_VALIDATE_URL) === FALSE) {
             $studio->user->avatar = url('uploads/images/thumbnail/' . $studio->user->avatar);
         }
         return view('pages.studio_artist', ['studio' => $studio, 'isArtistProfile' => $isArtistProfile, 'isFollowing' => $isFollowing]);
     }
     return redirect('/')->with("error", "Error!! Please try again..");
 }
Beispiel #5
0
 public static function isFollowing($user, $u)
 {
     return !!Follower::where('user_id', $user->id)->where('follow_id', $u->id)->count();
 }
Beispiel #6
0
 /**
  * Display the specified artist.
  *
  * @param  int  $id
  * @return Response
  */
 public function followers($id)
 {
     $artist = Artist::find($id);
     $user = Auth::user();
     $isArtistProfile = false;
     $isFollowing = false;
     if (Auth::check()) {
         if ($artist->user_id == Auth::User()->id) {
             $isArtistProfile = true;
         }
         if (Follower::where('user_id', $artist->user->id)->where('follower_id', $user->id)->count()) {
             $isFollowing = true;
         }
     }
     $followers = Follower::where('user_id', $user->id)->lists('follower_id');
     $followers = User::whereIn('id', $followers->toArray())->get();
     //dd($following);
     //if not an image url from facebook
     if (filter_var($artist->user->avatar, FILTER_VALIDATE_URL) === FALSE) {
         $artist->user->avatar = url('uploads/images/thumbnail/' . $artist->user->avatar);
     }
     $artist->cover = url('uploads/images/large/' . $artist->cover);
     return view('pages.artist_followers', ['artist' => $artist, 'isArtistProfile' => $isArtistProfile, 'isFollowing' => $isFollowing, 'followers' => $followers]);
 }
Beispiel #7
0
 /**
  * Follow Artist
  *
  * @return View
  */
 public function Follow(Request $request)
 {
     if (!$request->ajax()) {
         dd("NO ASYNC REQUEST");
     }
     $res = array();
     $res['success'] = false;
     $user = Auth::user();
     $whom = User::find($request->input('id'));
     if ($whom) {
         $followY = Follower::where('user_id', $whom->id)->where('follower_id', $user->id)->first();
         if ($followY) {
             $followY->delete();
             $res['success'] = true;
             $res['message'] = "Follow";
             //tell to follow
         } else {
             $follow = new Follower();
             $follow->user_id = $whom->id;
             $follow->follower_id = $user->id;
             $follow->save();
             $res['success'] = true;
             $res['message'] = "Unfollow";
             //tell to unfollow
         }
     }
     return $res;
 }
Beispiel #8
0
<div>
    @foreach($user as $posts)
		<center><img src="{{ asset($posts->user_image) }}" alt="D.P." width="150px"></center>
	@endforeach
</div>

<?php 
$use = \Auth::user()->id;
$count = \App\Confession::where('user_id', '=', $use)->count();
$follow = \App\Follower::where('user_id', '=', $use)->count();
$follower = \App\Follower::where('follow_id', '=', $use)->count();
?>

<div>
	<ul>

		<li style="padding-left: 10px">
			<a href="{{ url('/profile') }}">
				<span class="sideprofile-stats">Confessions</span><br>
				<span><b><?php 
echo $count;
?>
</b></span>
			</a>
		</li>
		<li>
			<a href="{{ url('/search') }}">
				<span class="sideprofile-stats">Following</span><br>
				<span ><b><?php 
echo $follow;
?>