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


PHP Group::leftjoin方法代码示例

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


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

示例1: edit

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return Response
     */
    public function edit($id)
    {
        $title = 'job';
        $skills = Skills::lists('name', 'name');
        if (Auth::user()->identifier == 1) {
            $postjob = Postjob::where('unique_id', '=', $id)->where('individual_id', '=', Auth::user()->induser_id)->first();
            $connections = 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');
            $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');
            $education = Education::orderBy('level')->orderBy('name')->get();
            $farearoleList = Functional_area_role_mapping::orderBy('id')->get();
            return view('pages.postjob_edit', compact('title', 'skills', 'connections', 'groups', 'education', 'farearoleList', 'postjob'));
        } else {
            $postjob = Postjob::where('unique_id', '=', $id)->where('corporate_id', '=', Auth::user()->corpuser_id)->first();
            $education = Education::all();
            $farearoleList = Functional_area_role_mapping::orderBy('id')->get();
            return view('pages.postjob_edit', compact('title', 'skills', 'education', 'farearoleList', 'postjob'));
        }
    }
开发者ID:devvicky,项目名称:Jobb-new,代码行数:32,代码来源:JobController.php

示例2: postFilter

    public function postFilter(Request $request)
    {
        $title = 'home';
        $sort_by = " ";
        $sort_by_skill = " ";
        $skillfilter = "";
        $skills = Skills::lists('name', 'name');
        $filter = Filter::where('from_user', '=', Auth::user()->id)->where('post_type', '=', 'job')->first();
        $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);
        $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);
        $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);
        $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');
        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()->corpuser_id != null) {
            $following = DB::select('select id from indusers
									 where indusers.id in (
										select follows.individual_id as id from follows
										where follows.corporate_id=?
								)', [Auth::user()->corpuser_id]);
            $following = collect($following);
        }
        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');
        }
        $skillPosts = Postjob::orderBy('id', 'desc')->with('indUser', 'corpUser', 'postActivity', 'taggedUser', 'taggedGroup')->where('post_type', '=', 'skill')->where('individual_id', '!=', Auth::user()->induser_id)->where('postjobs.inactive', '=', 0)->paginate(15);
        // $post_type = $request['post_type'];
        $post_title = $request['jobTitle'];
        $experience = $request['experience'];
        $time_for = $request['time_for'];
        $skill = $request['jobSkill'] != null ? implode(',', $request['jobSkill']) : null;
        $industry = $request['industry'];
        // return $skill;
        $jobPosts = Postjob::orderBy('postjobs.id', 'desc')->with('indUser', 'corpUser', 'postActivity', 'preferLocations')->leftjoin('post_preferred_locations', 'post_preferred_locations.post_id', '=', 'postjobs.id')->where('individual_id', '!=', Auth::user()->induser_id)->where('inactive', '=', 0);
        if ($time_for != null) {
            $jobPosts->whereIn('time_for', $time_for);
        }
        /*if($post_type == 'job'){
        			$jobPosts->where('post_type', '=', $post_type);
        		}*/
        if ($skill != null) {
            $jobPosts->where('linked_skill', 'like', '%' . $skill . '%');
        }
        if ($post_title != null) {
            $jobPosts->where('post_title', 'like', '%' . $post_title . '%')->whereRaw("(job_detail like '%" . $post_title . "%' or role like '%" . $post_title . "%' or linked_skill like '%" . $post_title . "%')");
        }
        if ($industry != null) {
            $jobPosts->where('industry', 'like', '%' . $industry . '%');
        }
        if ($experience != null) {
            $jobPosts->whereRaw("{$experience} between min_exp and max_exp");
        }
        $jobPosts = $jobPosts->groupBy('unique_id')->paginate(15);
        // return $jobPosts;
        return view('pages.homeFiltered', compact('jobPosts', 'skillPosts', 'linksApproval', 'linksPending', 'title', 'links', 'groups', 'following', 'userSkills', 'skills', 'share_links', 'share_groups', 'sort_by', 'sort_by_skill', 'filter', 'skillfilter', 'submitFilter'));
    }
开发者ID:devvicky,项目名称:Jobb-new,代码行数:93,代码来源:PagesController.php


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