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


PHP BaseController::track方法代码示例

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


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

示例1: postPublicLogin

 /**
  * Log an user
  *
  * @return Response
  */
 public function postPublicLogin()
 {
     // Check if the form validates with success
     if ($this->checkLogin()) {
         // return var_dump($this->credentials);
         // redirect the user back to the intended page
         // or defaultpage if there isn't one
         if (Auth::attempt($this->credentials, true)) {
             //track user
             parent::track('loggin', 'Auth', Auth::user()->id);
             //return Redirect::intended('/');
             if (Request::ajax()) {
                 return Response::json(array('statut' => 'success', 'message' => I18n::get('auth.login-success'), 'user_id' => User::getIdByAuth(Auth::user()->id)));
             } else {
                 return Redirect::route('public.login')->with('success', I18n::get('auth.login-success'))->withInput(Input::except('password'));
             }
         } else {
             $user = AuthUser::where('email', Input::get('email'))->first();
             if (empty($user) || !isset($user)) {
                 if (Request::ajax()) {
                     return Response::json(array('statut' => 'danger', 'message' => I18n::get('auth.unknow_email')));
                 } else {
                     return Redirect::route('public.login')->with('error', I18n::get('auth.unknow_email'))->withInput(Input::except('password'));
                 }
             }
             if (Request::ajax()) {
                 return Response::json(array('statut' => 'danger', 'message' => I18n::get('auth.incorrect_password')));
             } else {
                 return Redirect::route('public.login')->with('error', I18n::get('auth.incorrect_password'))->withInput(Input::except('password'));
             }
         }
         $this->user = $user;
         return Redirect::to('/');
     }
     if (Request::ajax()) {
         return Response::json(array('statut' => 'danger', 'message' => I18n::get('auth.incorrect_password')));
     } else {
         return Redirect::route('public.login')->withInput()->withErrors($this->validator);
     }
 }
开发者ID:Metrakit,项目名称:dynamix,代码行数:45,代码来源:AuthController.php

示例2: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // delete
     $navigation = Nav::find($id);
     if (empty($navigation)) {
         return Redirect::to('admin/navigation')->with('success', Lang::get('admin.navigation_notfind'));
     }
     //delete all translation
     foreach ($navigation->i18n()->translations() as $translation) {
         if (!$translation->delete()) {
             return Redirect::to('admin/navigation')->with('error', Lang::get('admin.navigation_translation_delete_fail'));
         }
     }
     //equilibrate branche
     //here equilibrate orders of menu !
     //if parentid = 0, set all else other !
     $navigations = Nav::where('parent_id', $navigation->parent_id)->where('id', '<>', $navigation->id)->orderBy('order', 'ASC')->get();
     for ($count_navigation = count($navigations), $i = 0; $i < $count_navigation; $i++) {
         $navigations[$i]->order = $i + 1;
         $navigations[$i]->save();
     }
     //delete children if exists
     foreach ($navigation->children() as $child) {
         $child->delete();
     }
     // delete
     if ($navigation->delete()) {
         //track user
         parent::track('delete', 'Navigation', $navigation->id);
         Cache::forget('DB_Nav');
         return Redirect::to('admin/navigation')->with('success', Lang::get('admin.navigation_delete_success'));
     }
     return Redirect::to('admin/navigation')->with('success', Lang::get('admin.navigation_delete_fail'));
 }
开发者ID:Metrakit,项目名称:dynamix,代码行数:40,代码来源:AdminNavigationController.php

示例3: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //find resource
     $role = Role::find($id);
     //delete all permissions
     foreach ($role->permissions as $permission) {
         if (!$permission->delete()) {
             return Redirect::to('admin/role_permission')->with('error', Lang::get('admin.role_delete_fail'));
         }
     }
     // delete
     if ($role->delete()) {
         //track user
         parent::track('delete', 'Role', $role->id);
         return Redirect::to('admin/role_permission')->with('success', Lang::get('admin.role_delete_success'));
     }
     return Redirect::to('admin/role_permission')->with('success', Lang::get('admin.role_delete_fail'));
 }
开发者ID:Metrakit,项目名称:dynamix,代码行数:24,代码来源:AdminRoleController.php

示例4: postOption


//.........这里部分代码省略.........
     $site_name_locales = array();
     foreach (Input::all() as $k => $v) {
         if (strpos($k, 'site_name_') !== false) {
             $site_name_rules[$k] = Config::get('validator.admin.option_site_name');
             $site_name_locales[] = mb_substr($k, strlen('site_name_'), strlen($k) - strpos($k, 'site_name_'));
         }
     }
     //Making adaptive rules for social_title
     $social_title_rules = array();
     $social_title_locales = array();
     foreach (Input::all() as $k => $v) {
         if (strpos($k, 'social_title_') !== false) {
             $social_title_rules[$k] = Config::get('validator.admin.option_social_title');
             $social_title_locales[] = mb_substr($k, strlen('social_title_'), strlen($k) - strpos($k, 'social_title_'));
         }
     }
     //Making adaptive rules for social_description
     $social_description_rules = array();
     $social_description_locales = array();
     foreach (Input::all() as $k => $v) {
         if (strpos($k, 'social_description_') !== false) {
             $social_description_rules[$k] = Config::get('validator.admin.option_social_description');
             $social_description_locales[] = mb_substr($k, strlen('social_description_'), strlen($k) - strpos($k, 'social_description_'));
         }
     }
     $rules = array_merge($site_name_rules, $social_title_locales, $social_description_locales, Config::get('validator.admin.option'));
     // Validate the inputs
     $validator = Validator::make(Input::all(), $rules);
     // Check if the form validates with success
     if ($validator->passes()) {
         //Themes
         $activeThemePublic = Theme::where('type', 'public')->where('active', 1)->first();
         $activeThemeAdmin = Theme::where('type', 'admin')->where('active', 1)->first();
         //Change or not?
         if ($activeThemePublic->id != Input::get('theme_public')) {
             $activeThemePublic->active = false;
             $activeThemePublic->save();
             $newThemePublic = Theme::find(Input::get('theme_public'));
             $newThemePublic->active = true;
             $newThemePublic->save();
         }
         if ($activeThemeAdmin->id != Input::get('theme_admin')) {
             $activeThemeAdmin->active = false;
             $activeThemeAdmin->save();
             $newThemeAdmin = Theme::find(Input::get('theme_public'));
             $newThemeAdmin->active = true;
             $newThemeAdmin->save();
         }
         //Delete Cache
         Cache::forget('DB_ThemeByType');
         //Options
         $options = Option::all();
         foreach ($options as $option) {
             if ($option->key == "site_url") {
                 $option->value = Input::get('site_url');
             }
             if ($option->key == "cover_path") {
                 $option->value = Input::get('cover_path');
             }
             if ($option->key == "admin_email") {
                 $option->value = Input::get('admin_email');
             }
             if ($option->key == "analytics") {
                 $option->value = Input::get('analytics');
             }
             if ($option->key == "i18n_site_name") {
                 //Update translations
                 foreach ($site_name_locales as $locale) {
                     if (!I18n::find($option->value)->updateText($locale, Input::get('site_name_' . $locale))) {
                         return Redirect::to('admin/option')->with('error', Lang::get('admin.option_site_name_update_error'));
                     }
                 }
             }
             if ($option->key == "i18n_social_title") {
                 //Update translations
                 foreach ($social_title_locales as $locale) {
                     if (!I18n::find($option->value)->updateText($locale, Input::get('social_title_' . $locale))) {
                         return Redirect::to('admin/option')->with('error', Lang::get('admin.option_social_title_update_error'));
                     }
                 }
             }
             if ($option->key == "i18n_social_description") {
                 //Update translations
                 foreach ($social_description_locales as $locale) {
                     if (!I18n::find($option->value)->updateText($locale, Input::get('social_description_' . $locale))) {
                         return Redirect::to('admin/option')->with('error', Lang::get('admin.option_social_description_update_error'));
                     }
                 }
             }
             $option->save();
         }
         // Clear cache
         Cache::forget('options');
         //track user
         parent::track('update', 'Option', null);
         return Redirect::to('admin/option')->with('success', Lang::get('admin.option_success'));
     }
     // Show the page
     return Redirect::to('/admin/option')->withInput()->withErrors($validator);
 }
开发者ID:Metrakit,项目名称:dynamix,代码行数:101,代码来源:AdminController.php

示例5: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //find resource
     $tag = Tag::find($id);
     if (empty($tag)) {
         return Redirect::to('admin/tag')->with('success', Lang::get('admin.tag_delete_fail'));
     }
     //delete all translation
     foreach ($tag->i18n()->translations() as $translation) {
         if (!$translation->delete()) {
             return Redirect::to('admin/tag')->with('error', Lang::get('admin.tag_translation_delete_fail'));
         }
     }
     //delete all polymoprphic relation with Model
     foreach ($tag->taggables() as $taggable) {
         if (!$taggable->delete()) {
             return Redirect::to('admin/tag')->with('error', Lang::get('admin.tag_translation_delete_fail'));
         }
     }
     // delete
     if ($tag->delete()) {
         //track user
         parent::track('delete', 'Tag', $tag->id);
         return Redirect::to('admin/tag')->with('success', Lang::get('admin.tag_delete_success'));
     }
     return Redirect::to('admin/tag')->with('success', Lang::get('admin.tag_delete_fail'));
 }
开发者ID:Metrakit,项目名称:dynamix,代码行数:33,代码来源:AdminTagController.php


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