本文整理汇总了PHP中app\models\Client::whereIn方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::whereIn方法的具体用法?PHP Client::whereIn怎么用?PHP Client::whereIn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Client
的用法示例。
在下文中一共展示了Client::whereIn方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_advertiser
public function add_advertiser(Request $request)
{
if (Auth::check()) {
if (in_array('ADD_EDIT_ADVERTISER', $this->permission)) {
$validate = \Validator::make($request->all(), Advertiser::$rule);
if ($validate->passes()) {
if (User::isSuperAdmin()) {
$client_obj = Client::find($request->input('client_id'));
} else {
$usr_company = $this->user_company();
$client_obj = Client::whereIn('user_id', $usr_company)->find($request->input('client_id'));
}
if ($client_obj) {
$active = 'Inactive';
if ($request->input('active') == 'on') {
$active = 'Active';
}
$audit = new AuditsController();
$audit_key = $audit->generateRandomString();
$advertiser = new Advertiser();
$advertiser->name = $request->input('name');
$advertiser->domain_name = $request->input('domain_name');
$advertiser->status = $active;
$advertiser->description = $request->input('description');
$advertiser->client_id = $request->input('client_id');
$advertiser->save();
if ($request->has('to_model')) {
foreach ($request->input('to_model') as $index) {
$adv_mdl_map = new Advertiser_Model_Map();
$adv_mdl_map->advertiser_id = $advertiser->id;
$adv_mdl_map->model_id = $index;
$adv_mdl_map->save();
$audit->store('adv_mdl_map', $index, $advertiser->id, 'add', $audit_key);
}
}
$audit->store('advertiser', $advertiser->id, null, 'add', $audit_key);
return Redirect::to(url('/client/cl' . $request->input('client_id') . '/advertiser/adv' . $advertiser->id . '/edit'))->withErrors(['success' => true, 'msg' => "Advertiser added successfully"]);
}
return Redirect::back()->withErrors(['success' => false, 'msg' => 'please Select your Client'])->withInput();
}
return Redirect::back()->withErrors(['success' => false, 'msg' => $validate->messages()->all()])->withInput();
}
return Redirect::back()->withErrors(['success' => false, 'msg' => "You don't have permission"]);
}
return Redirect::to(url('user/login'));
}
示例2: getTargetgroup
public function getTargetgroup()
{
if (Auth::check()) {
if (in_array('ADD_EDIT_TARGETGROUP', $this->permission)) {
$adver_obj = '';
if (User::isSuperAdmin()) {
$targetgroup = Targetgroup::with(['getCampaign' => function ($q) {
$q->with(['getAdvertiser' => function ($p) {
$p->with('GetClientID');
}]);
}])->get();
$client_obj = Client::get();
} else {
$usr_company = $this->user_company();
$targetgroup = Targetgroup::whereHas('getCampaign', function ($p) use($usr_company) {
$p->whereHas('getAdvertiser', function ($q) use($usr_company) {
$q->whereHas('GetClientID', function ($p) use($usr_company) {
$p->whereIn('user_id', $usr_company);
});
});
})->get();
$client_obj = Client::whereIn('user_id', $usr_company)->get();
if (!$targetgroup) {
return Redirect::back()->withErrors(['success' => false, 'msg' => 'please Select your Client'])->withInput();
}
}
$iab_category_obj = Iab_Category::get();
return view('bulk.targetgroup')->with('client_obj', $client_obj)->with('iab_category_obj', $iab_category_obj)->with('targetgroup_obj', $targetgroup);
}
return Redirect::back()->withErrors(['success' => false, 'msg' => "You don't have permission"]);
}
}
示例3: ChangeStatus
public function ChangeStatus($id)
{
if (Auth::check()) {
if (in_array('ADD_EDIT_CLIENT', $this->permission)) {
$client_id = $id;
if (User::isSuperAdmin()) {
$client = Client::find($client_id);
} else {
$usr_company = $this->user_company();
$client = Client::whereIn('user_id', $usr_company)->find($id);
}
if ($client) {
$data = array();
$audit = new AuditsController();
if ($client->status == 'Active') {
array_push($data, 'status');
array_push($data, $client->status);
array_push($data, 'Inactive');
$client->status = 'Inactive';
$msg = 'disable';
} elseif ($client->status == 'Inactive') {
array_push($data, 'status');
array_push($data, $client->status);
array_push($data, 'Active');
$client->status = 'Active';
$msg = 'actived';
}
$audit->store('client', $client_id, $data, 'edit');
$client->save();
return $msg;
}
return Redirect::back()->withErrors(['success' => false, 'msg' => 'please Select your Client'])->withInput();
}
return Redirect::back()->withErrors(['success' => false, 'msg' => "You don't have permission"]);
}
return Redirect::to(url('user/login'));
}
示例4: ChangeState
//.........这里部分代码省略.........
break;
case 'advertiser':
if ($request->input('client') == '') {
$client = DB::table('impression')->join('client', 'impression.client_id', '=', 'client.id')->select(DB::raw('count(impression.client_id) as imps, impression.client_id as id , client.name'))->where('impression.advertiser_id', $request->input('advertiser'))->groupBy('impression.client_id')->orderBy('imps', 'DESC')->get();
}
$advertiser = DB::table('impression')->join('advertiser', 'impression.advertiser_id', '=', 'advertiser.id')->select(DB::raw('count(impression.advertiser_id) as imps, impression.advertiser_id as id , advertiser.name'))->whereRaw($query)->groupBy('impression.advertiser_id')->orderBy('imps', 'DESC')->get();
break;
case 'creative':
$creativ_client_advertiser = Creative::with(['getAdvertiser' => function ($q) {
$q->with('GetClientID');
}])->find($request->input('creative'));
if ($request->input('client') == '') {
$client = DB::table('impression')->join('client', 'impression.client_id', '=', 'client.id')->select(DB::raw('count(impression.client_id) as imps, impression.client_id as id , client.name'))->whereRaw($query)->where('impression.client_id', $creativ_client_advertiser->getAdvertiser->GetClientID->id)->groupBy('impression.client_id')->orderBy('imps', 'DESC')->get();
}
if ($request->input('advertiser') == '') {
$advertiser = DB::table('impression')->join('advertiser', 'impression.advertiser_id', '=', 'advertiser.id')->select(DB::raw('count(impression.advertiser_id) as imps, impression.advertiser_id as id , advertiser.name'))->whereRaw($query)->where('impression.advertiser_id', $creativ_client_advertiser->getAdvertiser->id)->groupBy('impression.advertiser_id')->orderBy('imps', 'DESC')->get();
}
$creative = DB::table('impression')->join('creative', 'impression.creative_id', '=', 'creative.id')->select(DB::raw('count(impression.creative_id) as imps, impression.creative_id as id , creative.name'))->whereRaw($query)->groupBy('impression.creative_id')->orderBy('imps', 'DESC')->get();
break;
case 'geosegment':
$geosegment_client_advertiser = GeoSegmentList::with(['getAdvertiser' => function ($q) {
$q->with('GetClientID');
}])->find($request->input('geosegment'));
// return dd($geosegment_client_advertiser->getAdvertiser);
if ($request->input('client') == '') {
$client = DB::table('impression')->join('client', 'impression.client_id', '=', 'client.id')->select(DB::raw('count(impression.client_id) as imps, impression.client_id as id , client.name'))->whereRaw($query)->where('impression.client_id', $geosegment_client_advertiser->getAdvertiser->GetClientID->id)->groupBy('impression.client_id')->orderBy('imps', 'DESC')->get();
}
if ($request->input('advertiser') == '') {
$advertiser = DB::table('impression')->join('advertiser', 'impression.advertiser_id', '=', 'advertiser.id')->select(DB::raw('count(impression.advertiser_id) as imps, impression.advertiser_id as id , advertiser.name'))->whereRaw($query)->where('impression.advertiser_id', $geosegment_client_advertiser->getAdvertiser->id)->groupBy('impression.advertiser_id')->orderBy('imps', 'DESC')->get();
}
$geosegment = DB::table('impression')->join('geosegmentlist', 'impression.geosegment_id', '=', 'geosegmentlist.id')->select(DB::raw('count(impression.geosegment_id) as imps, impression.geosegment_id as id , geosegmentlist.name'))->whereRaw($query)->groupBy('impression.geosegment_id')->orderBy('imps', 'DESC')->get();
break;
case 'client_unfilter':
$client = DB::table('impression')->join('client', 'impression.client_id', '=', 'client.id')->select(DB::raw('count(impression.client_id) as imps, impression.client_id as id , client.name'))->whereIn('impression.advertiser_id', $advertiserArry)->whereIn('impression.client_id', $clientArry)->groupBy('impression.client_id')->orderBy('imps', 'DESC')->get();
$advertiser = DB::table('impression')->join('advertiser', 'impression.advertiser_id', '=', 'advertiser.id')->select(DB::raw('count(impression.advertiser_id) as imps, impression.advertiser_id as id , advertiser.name'))->whereIn('impression.advertiser_id', $advertiserArry)->whereIn('impression.client_id', $clientArry)->groupBy('impression.advertiser_id')->orderBy('imps', 'DESC')->get();
$campaign = DB::table('impression')->join('campaign', 'impression.campaign_id', '=', 'campaign.id')->select(DB::raw('count(impression.campaign_id) as imps, impression.campaign_id as id , campaign.name'))->whereIn('impression.advertiser_id', $advertiserArry)->whereIn('impression.client_id', $clientArry)->groupBy('impression.campaign_id')->orderBy('imps', 'DESC')->get();
$targetgroup = DB::table('impression')->join('targetgroup', 'impression.targetgroup_id', '=', 'targetgroup.id')->select(DB::raw('count(impression.targetgroup_id) as imps, impression.targetgroup_id as id , targetgroup.name'))->whereIn('impression.advertiser_id', $advertiserArry)->whereIn('impression.client_id', $clientArry)->groupBy('impression.targetgroup_id')->orderBy('imps', 'DESC')->get();
$creative = DB::table('impression')->join('creative', 'impression.creative_id', '=', 'creative.id')->select(DB::raw('count(impression.creative_id) as imps, impression.creative_id as id , creative.name'))->whereIn('impression.advertiser_id', $advertiserArry)->whereIn('impression.client_id', $clientArry)->groupBy('impression.creative_id')->orderBy('imps', 'DESC')->get();
$geosegment = DB::table('impression')->join('geosegmentlist', 'impression.geosegment_id', '=', 'geosegmentlist.id')->select(DB::raw('count(impression.geosegment_id) as imps, impression.geosegment_id as id , geosegmentlist.name'))->whereIn('impression.advertiser_id', $advertiserArry)->whereIn('impression.client_id', $clientArry)->groupBy('impression.geosegment_id')->orderBy('imps', 'DESC')->get();
break;
}
if ($request->input('client') == '' and $client == '') {
$client = DB::table('impression')->join('client', 'impression.client_id', '=', 'client.id')->select(DB::raw('count(impression.client_id) as imps, impression.client_id as id , client.name'))->whereRaw($query)->groupBy('impression.client_id')->orderBy('imps', 'DESC')->get();
}
if ($request->input('advertiser') == '' and $advertiser == '') {
$advertiser = DB::table('impression')->join('advertiser', 'impression.advertiser_id', '=', 'advertiser.id')->select(DB::raw('count(impression.advertiser_id) as imps, impression.advertiser_id as id , advertiser.name'))->whereRaw($query)->groupBy('impression.advertiser_id')->orderBy('imps', 'DESC')->get();
}
if ($request->input('campaign') == '' and $campaign == '') {
$campaign = DB::table('impression')->join('campaign', 'impression.campaign_id', '=', 'campaign.id')->select(DB::raw('count(impression.campaign_id) as imps, impression.campaign_id as id , campaign.name'))->whereRaw($query)->groupBy('impression.campaign_id')->orderBy('imps', 'DESC')->get();
}
if ($request->input('targetgroup') == '') {
$targetgroup = DB::table('impression')->join('targetgroup', 'impression.targetgroup_id', '=', 'targetgroup.id')->select(DB::raw('count(impression.targetgroup_id) as imps, impression.targetgroup_id as id , targetgroup.name'))->whereRaw($query)->groupBy('impression.targetgroup_id')->orderBy('imps', 'DESC')->get();
}
if ($request->input('creative') == '') {
$creative = DB::table('impression')->join('creative', 'impression.creative_id', '=', 'creative.id')->select(DB::raw('count(impression.creative_id) as imps, impression.creative_id as id , creative.name'))->whereRaw($query)->groupBy('impression.creative_id')->orderBy('imps', 'DESC')->get();
}
if ($request->input('geosegmentlist') == '') {
$geosegment = DB::table('impression')->join('geosegmentlist', 'impression.geosegment_id', '=', 'geosegmentlist.id')->select(DB::raw('count(impression.geosegment_id) as imps, impression.geosegment_id as id , geosegmentlist.name'))->whereRaw($query)->groupBy('impression.geosegment_id')->orderBy('imps', 'DESC')->get();
}
// return dd($query);
if ($time != '') {
$impChart = Impression::where('event_type', 'impression')->whereRaw($query)->whereRaw('created_at ' . $time)->orderBy('created_at', 'ASC')->get();
$imps = 1;
$flg = 0;
// return dd($impChart);
$impsString = "Date,Imps\n";