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


PHP User::isSuperAdmin方法代码示例

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


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

示例1: GetView

 public function GetView()
 {
     if (Auth::check()) {
         if (in_array('VIEW_SEGMENT', $this->permission)) {
             if (User::isSuperAdmin()) {
                 $segment = Segment::with('getAdvertiser', 'getModel')->get();
             } else {
                 $usr_company = $this->user_company();
                 $segment = Segment::whereHas('getAdvertiser', function ($q) use($usr_company) {
                     $q->whereHas('GetClientID', function ($p) use($usr_company) {
                         $p->whereIn('user_id', $usr_company);
                     });
                 })->with('getModel')->get();
             }
             return view('segment.list')->with('segment_obj', $segment);
         }
         return Redirect::back()->withErrors(['success' => false, 'msg' => "You don't have permission"]);
     }
     return Redirect::to(url('/user/login'));
 }
开发者ID:bluelinemango,项目名称:mango,代码行数:20,代码来源:SegmentController.php

示例2: ChangeStatus

 public function ChangeStatus($id)
 {
     if (Auth::check()) {
         if (User::isSuperAdmin()) {
             $entity = Inventory::find($id);
         }
         if ($entity) {
             $data = array();
             $audit = new AuditsController();
             if ($entity->status == 'Active') {
                 array_push($data, 'status');
                 array_push($data, $entity->status);
                 array_push($data, 'Inactive');
                 $entity->status = 'Inactive';
                 $msg = 'disable';
             } elseif ($entity->status == 'Inactive') {
                 array_push($data, 'status');
                 array_push($data, $entity->status);
                 array_push($data, 'Active');
                 $entity->status = 'Active';
                 $msg = 'actived';
             }
             $audit->store('inventory', $id, $data, 'edit');
             $entity->save();
             return $msg;
         }
         return 'please Select your Client';
     }
     return Redirect::to(url('user/login'));
 }
开发者ID:bluelinemango,项目名称:mango,代码行数:30,代码来源:InventoryController.php

示例3: jqgrid

 public function jqgrid(Request $request)
 {
     //return dd($request->all());
     if (Auth::check()) {
         if (in_array('ADD_EDIT_USER', $this->permission)) {
             $validate = \Validator::make($request->all(), ['name' => 'required']);
             if ($validate->passes()) {
                 $user_id = substr($request->input('id'), 3);
                 if (User::isSuperAdmin()) {
                     $user = User::find($user_id);
                 } else {
                     $usr_company = $this->user_company();
                     $user = User::where('company_id', Auth::user()->company_id)->find($user_id);
                     if (!$user) {
                         return $msg = ['success' => false, 'msg' => "Some things went wrong"];
                     }
                 }
                 if ($user) {
                     $data = array();
                     $audit = new AuditsController();
                     if ($user->name != $request->input('name')) {
                         array_push($data, 'Name');
                         array_push($data, $user->name);
                         array_push($data, $request->input('name'));
                         $user->name = $request->input('name');
                     }
                     $audit->store('user', $user_id, $data, 'edit');
                     $user->save();
                     return $msg = ['success' => true, 'msg' => "your User Saved successfully"];
                 }
                 return $msg = ['success' => false, 'msg' => "Please Select a User First"];
             }
             return $msg = ['success' => false, 'msg' => "Please Check your field"];
         }
         return $msg = ['success' => false, 'msg' => "You don't have permission"];
     }
     return Redirect::to(url('/user/login'));
 }
开发者ID:bluelinemango,项目名称:mango,代码行数:38,代码来源:UsersController.php

示例4: ChangeStatus

 public function ChangeStatus($id)
 {
     if (Auth::check()) {
         if (in_array('ADD_EDIT_GEOSEGMENTLIST', $this->permission)) {
             if (User::isSuperAdmin()) {
                 $entity = GeoSegmentList::find($id);
             } else {
                 $usr_company = $this->user_company();
                 $entity = GeoSegmentList::whereHas('getAdvertiser', function ($q) use($usr_company) {
                     $q->whereHas('GetClientID', function ($p) use($usr_company) {
                         $p->whereIn('user_id', $usr_company);
                     });
                 })->find($id);
             }
             if ($entity) {
                 $data = array();
                 $audit = new AuditsController();
                 if ($entity->status == 'Active') {
                     array_push($data, 'status');
                     array_push($data, $entity->status);
                     array_push($data, 'Inactive');
                     $entity->status = 'Inactive';
                     $msg = 'disable';
                 } elseif ($entity->status == 'Inactive') {
                     array_push($data, 'status');
                     array_push($data, $entity->status);
                     array_push($data, 'Active');
                     $entity->status = 'Active';
                     $msg = 'actived';
                 }
                 $audit->store('geosegment', $id, $data, 'edit');
                 $entity->save();
                 return $msg;
             }
             return 'please Select your Client';
         }
         return "You don't have permission";
     }
     return Redirect::to(url('user/login'));
 }
开发者ID:bluelinemango,项目名称:mango,代码行数:40,代码来源:GeoSegmentController.php

示例5: destroy

 public function destroy(User $user, Category $category)
 {
     return $user->isSuperAdmin();
 }
开发者ID:niefufeng,项目名称:drip,代码行数:4,代码来源:CategoryPolicy.php

示例6: UploadCreative

 public function UploadCreative(Request $request)
 {
     if (Auth::check()) {
         if (in_array('ADD_EDIT_CREATIVE', $this->permission)) {
             if ($request->hasFile('upload')) {
                 if (User::isSuperAdmin()) {
                     $advertiser_obj = Advertiser::with('GetClientID')->find($request->input('advertiser_id'));
                 } else {
                     $usr_company = $this->user_company();
                     $advertiser_obj = Advertiser::whereHas('GetClientID', function ($p) use($usr_company) {
                         $p->whereIn('user_id', $usr_company);
                     })->find($request->input('advertiser_id'));
                     if (!$advertiser_obj) {
                         return Redirect::back()->withErrors(['success' => false, 'msg' => 'please Select your Client'])->withInput();
                     }
                 }
                 if ($advertiser_obj) {
                     $destpath = public_path();
                     $extension = $request->file('upload')->getClientOriginalExtension();
                     // getting image extension
                     $fileName = str_random(32) . '.' . $extension;
                     $request->file('upload')->move($destpath . '/cdn/test/', $fileName);
                     Config::set('excel.import.startRow', 12);
                     $upload = Excel::load('public/cdn/test/' . $fileName, function ($reader) {
                     })->get();
                     $t = array();
                     foreach ($upload[0] as $key => $value) {
                         array_push($t, $key);
                     }
                     if ($t[1] != 'name' or $t[2] != 'ad_tag' or $t[3] != 'landing_page_url' or $t[4] != 'preview_url' or $t[5] != 'size' or $t[6] != 'attributes' or $t[7] != 'advertiser_domain_name' or $t[8] != 'status' or $t[9] != 'api' or $t[10] != 'ad_type') {
                         File::delete($destpath . '/cdn/test/' . $fileName);
                         return Redirect::back()->withErrors(['success' => false, 'msg' => 'please be sure that file is correct'])->withInput();
                     }
                     $bad_input = array();
                     $count = 0;
                     foreach ($upload as $test) {
                         $flg = 0;
                         $creative = new Creative();
                         if ($test['name'] == '' or $test['ad_tag'] == '' or $test['landing_page_url'] == '' or $test['preview_url'] == '' or $test['size'] == '' or $test['attributes'] == '' or $test['advertiser_domain_name'] == '' or $test['status'] == '' or $test['api'] == '' or $test['ad_type'] == '') {
                             array_push($bad_input, $test['name']);
                             continue;
                         }
                         if (strcasecmp($test['status'], 'active') != 0 and strcasecmp($test['status'], 'inactive') != 0) {
                             array_push($bad_input, $test['name']);
                             continue;
                         }
                         $api = explode(',', $test['api']);
                         if (is_array($api)) {
                             foreach ($api as $index) {
                                 if (strcasecmp($index, 'VPAID_1.0') != 0 and strcasecmp($index, 'VPAID_2.0') != 0 and strcasecmp($index, 'MRAID-1') != 0 and strcasecmp($index, 'ORMMA') != 0 and strcasecmp($index, 'MRAID-2') != 0) {
                                     array_push($bad_input, $test['name']);
                                     $flg = 1;
                                 }
                             }
                             if ($flg == 1) {
                                 $flg = 0;
                                 continue;
                             }
                         } else {
                             array_push($bad_input, $test['name']);
                             continue;
                         }
                         if (strcasecmp($test['ad_type'], 'IFRAME') != 0 and strcasecmp($test['ad_type'], 'JAVASCRIPT') != 0 and strcasecmp($test['ad_type'], 'XHTML_BANNER_AD') != 0 and strcasecmp($test['ad_type'], 'XHTML_TEXT_AD') != 0) {
                             array_push($bad_input, $test['name']);
                             return dd('ss2');
                             continue;
                         }
                         $size = explode('x', $test['size']);
                         if (!is_array($size) or count($size) != 2 or is_array($size) and count($size) == 2 and !is_numeric($size[0]) or is_array($size) and count($size) == 2 and !is_numeric($size[1])) {
                             array_push($bad_input, $test['name']);
                             continue;
                         }
                         $creative->name = $test['name'];
                         $creative->ad_tag = $test['ad_tag'];
                         $creative->landing_page_url = $test['landing_page_url'];
                         $creative->preview_url = $test['preview_url'];
                         $creative->size = $size[0] . 'x' . $size[1];
                         $creative->attributes = $test['attributes'];
                         $creative->advertiser_domain_name = $test['advertiser_domain_name'];
                         $creative->status = ucwords(strtolower($test['status']));
                         $creative->api = '[' . strtoupper(implode(',', $api)) . ']';
                         $creative->ad_type = strtoupper($test['ad_type']);
                         $creative->advertiser_id = $request->input('advertiser_id');
                         $creative->save();
                         $count++;
                     }
                     $audit = new AuditsController();
                     $audit->store('creative', 0, $count, 'bulk_add');
                     $msg = "Creatives added successfully";
                     if (count($bad_input) > 0) {
                         $msg .= " exept: ";
                         foreach ($bad_input as $index) {
                             $msg .= $index . ',';
                         }
                     }
                     return Redirect::back()->withErrors(['success' => true, 'msg' => $msg]);
                 }
                 return Redirect::back()->withErrors(['success' => false, 'msg' => 'please Select Advertiser First'])->withInput();
             }
             return Redirect::back()->withErrors(['success' => false, 'msg' => 'please Select a file'])->withInput();
//.........这里部分代码省略.........
开发者ID:bluelinemango,项目名称:mango,代码行数:101,代码来源:CreativeController.php

示例7: approved

 public function approved(User $user)
 {
     return $user->status === User::STATUS_ACTIVE || $user->isSuperAdmin();
 }
开发者ID:niefufeng,项目名称:drip,代码行数:4,代码来源:CommentPolicy.php

示例8: destroy

 public function destroy(User $user, Content $content)
 {
     return $user->id === $content->user_id && ($user->status = User::STATUS_ACTIVE) || $user->isSuperAdmin();
 }
开发者ID:niefufeng,项目名称:drip,代码行数:4,代码来源:ContentPolicy.php

示例9: SubAudit

 public function SubAudit($audit)
 {
     $audit_obj = array();
     foreach ($audit as $index) {
         $entity_obj = null;
         switch ($index->entity_type) {
             case 'user':
                 if (in_array('VIEW_USER', $this->permission)) {
                     $entity_obj = User::find($index->entity_id);
                 }
                 break;
             case 'company':
                 if (User::isSuperAdmin()) {
                     $entity_obj = \App\Models\Company::find($index->entity_id);
                 }
                 break;
             case 'inventory':
                 if (User::isSuperAdmin()) {
                     $entity_obj = Inventory::find($index->entity_id);
                 }
                 break;
             case 'client':
                 if (in_array('VIEW_CLIENT', $this->permission)) {
                     $entity_obj = Client::find($index->entity_id);
                 }
                 break;
             case 'advertiser':
                 if (in_array('VIEW_ADVERTISER', $this->permission)) {
                     $entity_obj = Advertiser::with('GetClientID')->find($index->entity_id);
                 }
                 break;
             case 'creative':
                 if (in_array('VIEW_CREATIVE', $this->permission)) {
                     $entity_obj = Creative::with(['getAdvertiser' => function ($q) {
                         $q->with('GetClientID');
                     }])->find($index->entity_id);
                 }
                 break;
             case 'campaign':
                 if (in_array('VIEW_CAMPAIGN', $this->permission)) {
                     $entity_obj = Campaign::with(['getAdvertiser' => function ($q) {
                         $q->with('GetClientID');
                     }])->find($index->entity_id);
                 }
                 break;
             case 'offer':
                 if (in_array('VIEW_OFFER', $this->permission)) {
                     $entity_obj = Offer::with(['getAdvertiser' => function ($q) {
                         $q->with('GetClientID');
                     }])->find($index->entity_id);
                 }
                 break;
             case 'pixel':
                 if (in_array('VIEW_PIXEL', $this->permission)) {
                     $entity_obj = Pixel::with(['getAdvertiser' => function ($q) {
                         $q->with('GetClientID');
                     }])->find($index->entity_id);
                 }
                 break;
             case 'targetgroup':
                 if (in_array('VIEW_TARGETGROUP', $this->permission)) {
                     $entity_obj = Targetgroup::find($index->entity_id);
                 }
                 break;
             case 'targetgroup_geolocation_map':
                 if (in_array('VIEW_TARGETGROUP', $this->permission)) {
                     if ($index->audit_type == 'del') {
                         $entity_obj = Geolocation::find($index->after_value);
                     } else {
                         $entity_obj = Geolocation::find($index->entity_id);
                     }
                 }
                 break;
             case 'targetgroup_creative_map':
                 if (in_array('VIEW_TARGETGROUP', $this->permission)) {
                     if ($index->audit_type == 'del') {
                         $entity_obj = Creative::find($index->after_value);
                     } else {
                         $entity_obj = Creative::find($index->entity_id);
                     }
                 }
                 break;
             case 'targetgroup_segment_map':
                 if (in_array('VIEW_TARGETGROUP', $this->permission)) {
                     if ($index->audit_type == 'del') {
                         $entity_obj = Segment::find($index->after_value);
                     } else {
                         $entity_obj = Segment::find($index->entity_id);
                     }
                 }
                 break;
             case 'targetgroup_geosegment_map':
                 if (in_array('VIEW_TARGETGROUP', $this->permission)) {
                     if ($index->audit_type == 'del') {
                         $entity_obj = GeoSegmentList::find($index->after_value);
                     } else {
                         $entity_obj = GeoSegmentList::find($index->entity_id);
                     }
                 }
                 break;
//.........这里部分代码省略.........
开发者ID:bluelinemango,项目名称:mango,代码行数:101,代码来源:AuditsController.php

示例10: jqgrid

 public function jqgrid(Request $request)
 {
     //        return dd($request->all());
     if (Auth::check()) {
         if (User::isSuperAdmin()) {
             $validate = \Validator::make($request->all(), ['name' => 'required']);
             if ($validate->passes()) {
                 switch ($request->input('oper')) {
                     case 'add':
                         $audit = new AuditsController();
                         $active = 'Inactive';
                         if ($request->input('active') == 'true') {
                             $active = 'Active';
                         }
                         $company = new Company();
                         $company->name = $request->input('name');
                         $company->save();
                         $audit->store('company', $company->id, null, 'add');
                         return $msg = ['success' => true, 'msg' => "your Company:cl{$company->id} Added successfully"];
                         break;
                     case 'edit':
                         $company_id = $request->input('id');
                         $company = Company::find($company_id);
                         if ($company) {
                             $data = array();
                             $audit = new AuditsController();
                             if ($company->name != $request->input('name')) {
                                 array_push($data, 'Name');
                                 array_push($data, $company->name);
                                 array_push($data, $request->input('name'));
                                 $company->name = $request->input('name');
                             }
                             $audit->store('company', $company_id, $data, 'edit');
                             $company->save();
                             return $msg = ['success' => true, 'msg' => "your Company:cl{$company_id} Saved saved successfully"];
                         }
                         break;
                 }
             }
         }
         return "don't have permission";
     }
     return Redirect::to(url('user/login'));
 }
开发者ID:bluelinemango,项目名称:mango,代码行数:44,代码来源:CompanyController.php

示例11: 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'));
 }
开发者ID:bluelinemango,项目名称:mango,代码行数:37,代码来源:ClientController.php

示例12: creative_bulk

 public function creative_bulk(Request $request)
 {
     //        return dd($request->all());
     if (Auth::check()) {
         if (in_array('ADD_EDIT_CREATIVE', $this->permission)) {
             $validate = $this->validation($request);
             if ($validate->passes()) {
                 $usr_company = $this->user_company();
                 $audit = new AuditsController();
                 $audit_key = $audit->generateRandomString();
                 if ($request->input('advertiser_id') == 'all' and !$request->has('creative_list')) {
                     if ($request->input('client_id') == 'all') {
                         if (User::isSuperAdmin()) {
                             $creative_list = Creative::get(['id'])->toArray();
                         } else {
                             $creative_list = Creative::whereHas('getAdvertiser', function ($q) use($usr_company) {
                                 $q->whereHas('GetClientID', function ($p) use($usr_company) {
                                     $p->whereIn('user_id', $usr_company);
                                 });
                             })->get(['id'])->toArray();
                         }
                     } elseif ($request->input('client_id') != 'all') {
                         if (User::isSuperAdmin()) {
                             $creative_list = Creative::whereHas('getAdvertiser', function ($q) use($request) {
                                 $q->where('client_id', $request->input('client_id'));
                             })->get(['id'])->toArray();
                         } else {
                             ////////////////////////
                             $creative_list = Creative::whereHas('getAdvertiser', function ($q) use($usr_company, $request) {
                                 $q->whereHas('GetClientID', function ($p) use($usr_company, $request) {
                                     $p->where('id', $request->input('client_id'))->whereIn('user_id', $usr_company);
                                 });
                             })->get(['id'])->toArray();
                         }
                     }
                 } elseif ($request->input('advertiser_id') != 'all' and !$request->has('creative_list')) {
                     if (User::isSuperAdmin()) {
                         $creative_list = Creative::whereHas('getAdvertiser', function ($q) use($request) {
                             $q->where('id', $request->input('advertiser_id'));
                         })->get(['id'])->toArray();
                     } else {
                         ////////////////////////
                         $creative_list = Creative::whereHas('getAdvertiser', function ($q) use($usr_company, $request) {
                             $q->where('id', $request->input('advertiser_id'))->whereHas('GetClientID', function ($p) use($usr_company, $request) {
                                 $p->whereIn('user_id', $usr_company);
                             });
                         })->get(['id'])->toArray();
                     }
                 } else {
                     $creative_list = explode(',', $request->input('creative_list'));
                 }
                 if (count($creative_list) > 0) {
                     foreach ($creative_list as $index) {
                         $data = array();
                         if (!$request->has('creative_list')) {
                             $creative_id = $index['id'];
                             $creative = Creative::find($creative_id);
                         } else {
                             $creative_id = $index;
                             if (User::isSuperAdmin()) {
                                 $creative = Creative::find($creative_id);
                             } else {
                                 $usr_company = $this->user_company();
                                 $creative = Creative::whereHas('getAdvertiser', function ($q) use($usr_company) {
                                     $q->whereHas('GetClientID', function ($p) use($usr_company) {
                                         $p->whereIn('user_id', $usr_company);
                                     });
                                 })->find($creative_id);
                             }
                         }
                         if ($creative) {
                             if ($request->has('size_width') and $request->has('size_height')) {
                                 $size = $request->input('size_width') . 'x' . $request->input('size_height');
                             }
                             if ($request->input('name')) {
                                 array_push($data, 'Name');
                                 array_push($data, $request->input('name'));
                                 $creative->name = $request->input('name');
                             }
                             if ($request->has('active')) {
                                 $active = 'Inactive';
                                 if ($request->input('active') == 'on') {
                                     $active = 'Active';
                                 }
                                 array_push($data, 'Status');
                                 array_push($data, $active);
                                 $creative->status = $active;
                             }
                             if ($request->input('ad_type')) {
                                 array_push($data, 'Ad Type');
                                 array_push($data, $request->input('ad_type'));
                                 $creative->ad_type = $request->input('ad_type');
                             }
                             if ($request->has('api')) {
                                 array_push($data, 'API');
                                 array_push($data, json_encode($request->input('api')));
                                 $creative->api = json_encode($request->input('api'));
                             }
                             if ($request->input('advertiser_domain_name')) {
                                 array_push($data, 'Domain Name');
//.........这里部分代码省略.........
开发者ID:bluelinemango,项目名称:mango,代码行数:101,代码来源:MangoController.php

示例13: ChangeState

 public function ChangeState(Request $request)
 {
     //        return dd($request->all());
     if (Auth::check()) {
         if (in_array('VIEW_ADVERTISER', $this->permission)) {
             //TODO: set report permission
             $type = $request->input('type');
             $arr = array();
             array_push($arr, $type);
             $time = '';
             $client = '';
             $advertiser = '';
             $creative = '';
             $geosegment = '';
             $campaign = '';
             $targetgroup = '';
             if (User::isSuperAdmin()) {
                 $clientArry = Client::get(['id'])->toArray();
                 $advertiserArry = Advertiser::get(['id'])->toArray();
                 $query = "1 = 1 ";
                 if ($request->has('client')) {
                     $query .= " and impression.client_id=" . $request->input('client');
                 }
                 if ($request->has('advertiser')) {
                     $query .= " and impression.advertiser_id=" . $request->input('advertiser');
                 }
                 if ($request->has('creative')) {
                     $query .= " and impression.creative_id=" . $request->input('creative');
                 }
                 if ($request->has('geosegment')) {
                     $query .= " and impression.geosegment_id=" . $request->input('geosegment');
                 }
                 if ($request->has('campaign')) {
                     $query .= " and impression.campaign_id=" . $request->input('campaign');
                 }
                 if ($request->has('targetgroup')) {
                     $query .= " and impression.targetgroup_id=" . $request->input('targetgroup');
                 }
                 if ($request->input('report_type') == 'today') {
                     $time = "between '" . date('Y-m-d H:i:s', time() - 60 * 60 * 24) . "' and '" . date('Y-m-d H:i:s', time() + 60 * 30 * 10) . "'";
                     $interval = 300;
                     $query .= " and impression.created_at " . $time;
                 }
                 if ($request->input('report_type') == '10m') {
                     $time = "between '" . date('Y-m-d H:i:s', time() - 600) . "' and '" . date('Y-m-d H:i:s') . "'";
                     $query .= " and impression.created_at " . $time;
                     $interval = 10;
                 }
                 if ($request->input('report_type') == '1h') {
                     $time = "between '" . date('Y-m-d H:i:s', time() - 60 * 60) . "' and '" . date('Y-m-d H:i:s') . "'";
                     $query .= " and impression.created_at " . $time;
                     $interval = 30;
                 }
                 if ($request->input('report_type') == '3h') {
                     $time = "between '" . date('Y-m-d H:i:s', time() - 60 * 60 * 3) . "' and '" . date('Y-m-d H:i:s') . "'";
                     $query .= " and impression.created_at " . $time;
                     $interval = 60;
                 }
                 if ($request->input('report_type') == '6h') {
                     $time = "between '" . date('Y-m-d H:i:s', time() - 60 * 60 * 6) . "' and '" . date('Y-m-d H:i:s') . "'";
                     $query .= " and impression.created_at " . $time;
                     $interval = 120;
                 }
                 if ($request->input('report_type') == '1D') {
                     $time = "between '" . date('Y-m-d H:i:s', time() - 60 * 60 * 24) . "' and '" . date('Y-m-d H:i:s') . "'";
                     $query .= " and impression.created_at " . $time;
                     $interval = 300;
                 }
                 if ($request->input('report_type') == '1M') {
                     $time = "between '" . date('Y-m-d H:i:s', time() - 60 * 60 * 24 * 30) . "' and '" . date('Y-m-d H:i:s') . "'";
                     $query .= " and impression.created_at " . $time;
                     $interval = 60 * 60;
                 }
                 if ($request->input('report_type') == 'rang') {
                     //todo: 120 noghte
                     if ($this->report_date_validation($request->input('date_range'))) {
                         $date_range = explode('&', $request->input('date_range'));
                         $start_date = explode('T', $date_range[0]);
                         $end_date = explode('T', $date_range[1]);
                         $time = "between '" . $start_date[0] . ' ' . $start_date[1] . "' and '" . $end_date[0] . ' ' . $end_date[1] . "'";
                         $query .= " and impression.created_at " . $time;
                         $interval = 24 * 60 * 60;
                     }
                 }
                 switch ($type) {
                     case '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') == '') {
                             $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 'report_type':
                         $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();
                         $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();
                         $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();
                         $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();
                         $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();
                         $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 'campaign':
//.........这里部分代码省略.........
开发者ID:bluelinemango,项目名称:mango,代码行数:101,代码来源:ReportController.php

示例14: jqgrid

 public function jqgrid(Request $request)
 {
     //        return dd($request->all());
     if (Auth::check()) {
         if (in_array('ADD_EDIT_MODEL', $this->permission)) {
             $validate = \Validator::make($request->all(), ['name' => 'required']);
             if ($validate->passes()) {
                 $model_id = substr($request->input('id'), 3);
                 if (User::isSuperAdmin()) {
                     $modelTable = ModelTable::find($model_id);
                 } else {
                     $usr_company = $this->user_company();
                     $modelTable = ModelTable::whereHas('getAdvertiser', function ($q) use($usr_company) {
                         $q->whereHas('GetClientID', function ($p) use($usr_company) {
                             $p->whereIn('user_id', $usr_company);
                         });
                     })->find($model_id);
                 }
                 if ($modelTable) {
                     $data = array();
                     $audit = new AuditsController();
                     if ($modelTable->name != $request->input('name')) {
                         array_push($data, 'Name');
                         array_push($data, $modelTable->name);
                         array_push($data, $request->input('name'));
                         $modelTable->name = $request->input('name');
                     }
                     $audit->store('modelTable', $model_id, $data, 'edit');
                     $modelTable->save();
                     return $msg = ['success' => true, 'msg' => "your Model Saved successfully"];
                 }
                 return $msg = ['success' => false, 'msg' => "Please Select a Model First"];
             }
             return $msg = ['success' => false, 'msg' => "Please Check your field"];
         }
         return $msg = ['success' => false, 'msg' => "You don't have permission"];
     }
     return Redirect::to(url('/user/login'));
 }
开发者ID:bluelinemango,项目名称:mango,代码行数:39,代码来源:ModelController.php

示例15: jqgrid

 public function jqgrid(Request $request)
 {
     if (Auth::check()) {
         if (in_array('ADD_EDIT_ADVERTISER', $this->permission)) {
             $validate = \Validator::make($request->all(), ['name' => 'required']);
             if ($validate->passes()) {
                 $adver_id = substr($request->input('id'), 3);
                 if (User::isSuperAdmin()) {
                     $adver = Advertiser::find($adver_id);
                 } else {
                     $usr_company = $this->user_company();
                     $adver = Advertiser::whereHas('GetClientID', function ($p) use($usr_company) {
                         $p->whereIn('user_id', $usr_company);
                     })->with('Campaign')->with('Model')->with('GeoSegment')->with('BWList')->with('Creative')->with('GetClientID')->find($adver_id);
                 }
                 if ($adver) {
                     $data = array();
                     $audit = new AuditsController();
                     if ($adver->name != $request->input('name')) {
                         array_push($data, 'Name');
                         array_push($data, $adver->name);
                         array_push($data, $request->input('name'));
                         $adver->name = $request->input('name');
                     }
                     $audit->store('advertiser', $adver_id, $data, 'edit');
                     $adver->save();
                     return $msg = ['success' => true, 'msg' => "your Advertiser name Saved successfully"];
                 }
                 return $msg = ['success' => false, 'msg' => "Please Select an Advertiser First"];
             }
             return $msg = ['success' => false, 'msg' => "Please fill all Fields"];
         }
         return $msg = ['success' => false, 'msg' => "You don't have permission"];
     }
     return Redirect::to(url('user/login'));
 }
开发者ID:bluelinemango,项目名称:mango,代码行数:36,代码来源:AdvertiserController.php


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