コード例 #1
0
 public function followers()
 {
     $title = 'followers';
     $followers = Corpuser::find(Auth::user()->corpuser_id)->followers;
     return view('pages.connections', compact('title', 'followers'));
 }
コード例 #2
0
ファイル: PagesController.php プロジェクト: devvicky/Jobb-new
    public function postedByCorp($id)
    {
        if (Auth::check()) {
            $title = 'postByCorporate';
            $groups = array();
            $postCorp = Corpuser::find($id);
            $filter = Filter::where('post_type', '=', 'job')->where('from_user', '=', Auth::user()->id)->first();
            $skillfilter = Filter::where('from_user', '=', Auth::user()->id)->where('post_type', '=', 'skill')->first();
            $jobPosts = Postjob::orderBy('id', 'desc')->with('indUser', 'corpUser', 'postActivity', 'taggedUser', 'taggedGroup')->where('post_type', '=', 'job')->where('corporate_id', '=', $id)->where('inactive', '=', 0)->paginate(15);
            $skillPosts = Postjob::orderBy('id', 'desc')->with('indUser', 'corpUser', 'postActivity', 'taggedUser', 'taggedGroup')->where('post_type', '=', 'skill')->where('individual_id', '!=', Auth::user()->induser_id)->where('inactive', '=', 0)->paginate(15);
            $links = DB::select('select id from indusers
									where indusers.id in (
											select connections.user_id as id from connections
											where connections.connection_user_id=?
											 and connections.status=1
											union 
											select connections.connection_user_id as id from connections
											where connections.user_id=?
											 and connections.status=1
								)', [Auth::user()->induser_id, Auth::user()->induser_id]);
            $links = collect($links);
            $linksPending = DB::select('select id from indusers
											where indusers.id in (
													select connections.connection_user_id as id from connections
													where connections.user_id=?
													 and connections.status=0
											)', [Auth::user()->induser_id]);
            $linksPending = collect($linksPending);
            $linksApproval = DB::select('select id from indusers
											where indusers.id in (
													select connections.user_id as id from connections
													where connections.connection_user_id=?
													 and connections.status=0
											)', [Auth::user()->induser_id]);
            $linksApproval = collect($linksApproval);
            if (Auth::user()->identifier == 1) {
                $share_links = Induser::whereRaw('indusers.id in (
												select connections.user_id as id from connections
												where connections.connection_user_id=?
												 and connections.status=1
												union 
												select connections.connection_user_id as id from connections
												where connections.user_id=?
												 and connections.status=1
									)', [Auth::user()->induser_id, Auth::user()->induser_id])->get(['id', 'fname'])->lists('fname', 'id');
                $share_groups = Group::leftjoin('groups_users', 'groups_users.group_id', '=', 'groups.id')->where('groups.admin_id', '=', Auth::user()->induser_id)->orWhere('groups_users.user_id', '=', Auth::user()->induser_id)->groupBy('groups.id')->get(['groups.id as id', 'groups.group_name as name'])->lists('name', 'id');
            }
            $groups = Group::leftjoin('groups_users', 'groups_users.group_id', '=', 'groups.id')->where('groups.admin_id', '=', Auth::user()->induser_id)->orWhere('groups_users.user_id', '=', Auth::user()->induser_id)->groupBy('groups.id')->get(['groups.id as id'])->lists('id');
            $skills = Skills::lists('name', 'id');
            if (Auth::user()->induser_id != null) {
                $following = DB::select('select id from corpusers 
										 where corpusers.id in (
											select follows.corporate_id as id from follows
											where follows.individual_id=?
									)', [Auth::user()->induser_id]);
                $following = collect($following);
            }
            if (Auth::user()->identifier == 1) {
                $userSkills = Induser::where('id', '=', Auth::user()->induser_id)->first(['linked_skill']);
                $userSkills = array_map('trim', explode(',', $userSkills->linked_skill));
                unset($userSkills[count($userSkills) - 1]);
            }
            return view('pages.home', compact('jobPosts', 'share_links', 'share_groups', 'skillPosts', 'linksPending', 'linksApproval', 'title', 'links', 'groups', 'following', 'userSkills', 'skills', 'postCorp', 'filter', 'skillfilter'));
            // return $userSkills;
        } else {
            return redirect('login');
        }
    }