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


PHP Filter::find方法代码示例

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


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

示例1: actionUpdate

 public function actionUpdate($id)
 {
     $this->view->title = __('update comment filter') . "#" . $id;
     $model = Filter::find($id);
     $model->scenario = 'all';
     if ($this->populate($_POST, $model) && $model->validate()) {
         $model->save();
         flash('success', __('update sucessful'));
         $this->redirect(url('comment/filter/index'));
     }
     echo $this->render('form', array('model' => $model, 'name' => 'comment_filter'));
 }
开发者ID:rocketyang,项目名称:mincms,代码行数:12,代码来源:FilterController.php

示例2: postManageFilters

 public function postManageFilters()
 {
     /* code is a bit messy, lots of repetition, try to refactor later */
     $active = Input::has('emp_filter');
     $filter = Filter::find(1);
     $filter->update(['active' => $active]);
     $active = Input::has('prop_filter');
     $filter = Filter::find(2);
     $filter->update(['active' => $active]);
     $active = Input::has('perf_filter');
     $filter = Filter::find(3);
     $filter->update(['active' => $active]);
     return Redirect::route('manage-filters')->with('alert', 'success|Filters have been updated successfully.');
 }
开发者ID:codeblues1516,项目名称:godaddy,代码行数:14,代码来源:AdminController.php

示例3: actionShow

 /**
  * @param null|integer $id
  * @return string
  *
  * Shows parent categories and products of this category if category has not children categories.
  */
 public function actionShow($id = null)
 {
     if (is_null($id)) {
         $childCategories = Category::find()->where(['parent_id' => null, 'show' => true])->all();
         $this->registerStaticSeoData();
     } else {
         $category = Category::findOne($id);
         $category->registerMetaData();
         $childCategories = $category->getChildren();
         $descendantCategories = $category->getDescendants($category);
         array_push($descendantCategories, $category);
     }
     if ($this->module->showChildCategoriesProducts || empty($childCategories)) {
         $filters = !empty($category) ? Filter::find()->where(['category_id' => $category->id])->all() : null;
         $cart = new CartForm();
         $searchModel = new ProductSearch();
         $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $descendantCategories ?? null);
     }
     return $this->render('show', ['category' => $category ?? null, 'childCategories' => $childCategories, 'filters' => $filters ?? null, 'cart' => $cart ?? null, 'dataProvider' => $dataProvider ?? null]);
 }
开发者ID:black-lamp,项目名称:blcms-shop,代码行数:26,代码来源:CategoryController.php

示例4: function

    if (Auth::guest() || Auth::user()->roles->count() < 1) {
        return Redirect::route('home')->with('alert', 'warning|You must be signed in as an Administrator to access this area.');
    }
});
/* Super Administrator */
Route::filter('super-admin', function () {
    if (Auth::guest() || Auth::user()->hasRole('Super Administrator') === false) {
        return Redirect::route('home')->with('alert', 'warning|You must be signed in as a Super Administrator to access this area.');
    }
});
/* Employee MS Administrator */
Route::filter('emp-admin', function () {
    $filter = Filter::find(1);
    if (Auth::guest() || Auth::user()->hasRole('Employee MS Administrator') === false && $filter->active) {
        return Redirect::route('home')->with('alert', 'warning|You must be signed in as an Employee MS Administrator to access this area.');
    }
});
/* Property MS Administrator */
Route::filter('prop-admin', function () {
    $filter = Filter::find(2);
    if (Auth::guest() || Auth::user()->hasRole('Property MS Administrator') === false && $filter->active) {
        return Redirect::route('home')->with('alert', 'warning|You must be signed in as a Property MS Administrator to access this area.');
    }
});
/* Performance MS Administrator */
Route::filter('perf-admin', function () {
    $filter = Filter::find(3);
    if (Auth::guest() || Auth::user()->hasRole('Performance MS Administrator') === false && $filter->active) {
        return Redirect::route('home')->with('alert', 'warning|You must be signed in as a Performance MS Administrator to access this area.');
    }
});
开发者ID:codeblues1516,项目名称:godaddy,代码行数:31,代码来源:filters.php

示例5: postIndex

 /**
  * Handle submitted settings.
  *
  * @return
  */
 public function postIndex()
 {
     if (Input::has('api_key_id')) {
         $api_key_id = Setting::where('key', 'api_key_id')->firstOrFail();
         $api_key_id->value = Input::get('api_key_id');
         $api_key_id->save();
     }
     if (Input::has('api_key_verification_code')) {
         $api_key_verification_code = Setting::where('key', 'api_key_verification_code')->firstOrFail();
         $api_key_verification_code->value = Input::get('api_key_verification_code');
         $api_key_verification_code->save();
     }
     if (Input::has('api_key_character_id')) {
         $api_key_character_id = Setting::where('key', 'api_key_character_id')->firstOrFail();
         $api_key_character_id->value = Input::get('api_key_character_id');
         $api_key_character_id->save();
     }
     if (Input::has('home_region_id')) {
         $home_region_id = Setting::where('key', 'home_region_id')->firstOrFail();
         $home_region_id->value = Input::get('home_region_id');
         $home_region_id->save();
     }
     if (Input::has('systems')) {
         // Clean up the input in case the JS screwed up somewhere.
         $input = preg_replace('/^,|,$/', '', Input::get('systems'));
         $systems = Setting::where('key', 'systems')->firstOrFail();
         $systems->value = $input;
         $systems->save();
     }
     if (Input::has('alliances')) {
         // Clean up the input in case the JS screwed up somewhere.
         $input = preg_replace('/^,|,$/', '', Input::get('alliances'));
         $alliances = Setting::where('key', 'alliances')->firstOrFail();
         $alliances->value = $input;
         $alliances->save();
         // We also need to populate the alliances table with these new alliances.
         $response = API::eveOnline('eve/AllianceList', 'version=1');
         foreach ($response->body->result->rowset->row as $row) {
             if (strpos($input, (string) $row['allianceID']) !== FALSE) {
                 $alliance = Alliance::find($row['allianceID']);
                 if (!isset($alliance->id)) {
                     $alliance = new Alliance();
                     $alliance->id = $row['allianceID'];
                     $alliance->allianceName = $row['name'];
                     $alliance->save();
                 }
             }
         }
     }
     if (Input::has('shipping_cost')) {
         $shipping_cost = Setting::where('key', 'shipping_cost')->firstOrFail();
         $shipping_cost->value = Input::get('shipping_cost');
         $shipping_cost->save();
     }
     // Process default filters.
     DB::table('filters')->update(array('is_default' => 0));
     $filters = Filter::all();
     foreach ($filters as $filter) {
         if (Input::has($filter->categoryName)) {
             $category = Filter::find($filter->categoryID);
             $category->is_default = 1;
             $category->save();
         }
     }
     return Redirect::to('settings');
 }
开发者ID:orbitroom,项目名称:eve-traders-handbook,代码行数:71,代码来源:SettingsController.php

示例6: getZkillboard

 /**
  * Import zKillboard kills for the selected systems and alliances.
  */
 public function getZkillboard($systems = '')
 {
     // If this is the initial call to the function, retrieve the list of systems from the DB.
     if ($systems == '') {
         $systems_object = Setting::where('key', 'systems')->firstOrFail();
         $systems = $systems_object->value;
     }
     // Convert the comma-seperated string into an array.
     $systems_array = explode(',', $systems);
     // If there are more systems in the list than we want to pull at once, chop off the first X and call this function again.
     while (count($systems_array) > $this->api_system_limit) {
         $this->getZkillboard(implode(',', array_splice($systems_array, 0, $this->api_system_limit)));
     }
     // Retrieve the selected alliances from the database.
     $alliances = Setting::where('key', 'alliances')->firstOrFail();
     // Build the API URL.
     $url = 'https://zkillboard.com/api/xml/losses/no-attackers/' . 'allianceID/' . preg_replace('/\\s+/', '', $alliances->value) . '/' . 'solarSystemID/' . preg_replace('/\\s+/', '', $systems) . '/';
     // Send the request.
     $response = Request::get($url)->addHeader('Accept-Encoding', 'gzip')->addHeader('User-Agent', 'Eve Traders Handbook')->send();
     if (isset($response->body) && strlen($response->body) > 0) {
         $body = simplexml_load_string(gzdecode($response->body));
         $insert_count = 0;
         // Parse the response, inserting the losses into the database.
         foreach ($body->result->rowset->row as $row) {
             // First check whether this kill has not already been recorded.
             $kill = Kill::find($row['killID']);
             if (!isset($kill->killID)) {
                 // Create and save the new kill record.
                 $kill = new Kill();
                 $kill->killID = $row['killID'];
                 $kill->solarSystemID = $row['solarSystemID'];
                 $kill->characterID = $row->victim['characterID'];
                 $kill->characterName = $row->victim['characterName'];
                 $kill->allianceID = $row->victim['allianceID'];
                 $kill->corporationID = $row->victim['corporationID'];
                 $kill->shipTypeID = $row->victim['shipTypeID'];
                 $kill->killTime = $row['killTime'];
                 $kill->save();
                 $insert_count++;
                 // Insert the alliance information into the database unless it already exists.
                 $alliance = Alliance::find($kill->allianceID);
                 if (!isset($alliance->id)) {
                     $alliance = new Alliance();
                     $alliance->id = $kill->allianceID;
                     $alliance->allianceName = $row->victim['allianceName'];
                     $alliance->save();
                 }
                 // Insert the corporation information into the database unless it already exists.
                 $corporation = Corporation::find($kill->corporationID);
                 if (!isset($corporation->id)) {
                     $corporation = new Corporation();
                     $corporation->id = $kill->corporationID;
                     $corporation->corporationName = $row->victim['corporationName'];
                     $corporation->save();
                 }
                 // Insert the ship type that was lost into the database unless it already exists.
                 $ship = Ship::find($kill->shipTypeID);
                 $type = Type::find($kill->shipTypeID);
                 if (!isset($ship->id)) {
                     $ship = new Ship();
                     $ship->id = $kill->shipTypeID;
                     $ship->shipName = $type->typeName;
                     $ship->save();
                 }
                 // Insert the ship loss into the items database as well.
                 if (stristr($ship->shipName, 'Capsule') === FALSE) {
                     $item = new Item();
                     $item->killID = $row['killID'];
                     $item->typeID = $kill->shipTypeID;
                     $item->typeName = $type->typeName;
                     $item->categoryName = $type->group->category['categoryName'];
                     $item->metaGroupName = isset($type->metaType->metaGroup['metaGroupName']) ? $type->metaType->metaGroup['metaGroupName'] : '';
                     $item->allowManufacture = 1;
                     $item->qty = 1;
                     $item->save();
                 }
                 // Add the category to the list of filters available on the site.
                 $filter = Filter::find($type->group->category['categoryID']);
                 if (!isset($filter->categoryID)) {
                     $filter = new Filter();
                     $filter->categoryID = $type->group->category['categoryID'];
                     $filter->categoryName = $type->group->category['categoryName'];
                     $filter->iconID = $type->group->category['iconID'];
                     $filter->save();
                 }
                 // Loop through the items lost in the kill. Insert each one into the items table.
                 if (isset($row->rowset->row)) {
                     foreach ($row->rowset->row as $loss) {
                         $typeID = (int) $loss['typeID'];
                         $item = Item::where('typeID', '=', $typeID)->first();
                         // If this item already exists in the items table, we don't need to re-query all the additional
                         // information, we can just copy it from an existing row.
                         if (isset($item)) {
                             // This type has already been seen. Duplicate the record and save the new instance.
                             $clone = new Item();
                             $clone = $item->replicate();
                             // Update the right killID and quantity, and unset the primary key and date columns.
//.........这里部分代码省略.........
开发者ID:orbitroom,项目名称:eve-traders-handbook,代码行数:101,代码来源:ImportController.php

示例7: deleteDutchKills

 public function deleteDutchKills($id)
 {
     $filter = Filter::find($id);
     foreach ($filter->images as $img) {
         File::delete(FilterImage::getImagesFolderAbsolutePath() . $img->image_name);
         $img->delete();
     }
     $filter->delete();
     return Redirect::route('dashboard.dutch-kills.get');
 }
开发者ID:rilence,项目名称:pacificSite,代码行数:10,代码来源:DashboardController.php


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