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


PHP Type::where方法代码示例

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


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

示例1: getIndex

 public function getIndex()
 {
     $key = Input::get('search');
     if (isset($key)) {
         $data = Type::where('name', 'like', '%' . $key . '%')->orderBy('id', 'desc')->paginate(10);
     } else {
         $data = Type::orderBy('id', 'desc')->paginate(10);
     }
     return View::make('home/dashboard', array())->nest('content', 'Type/index', array('data' => $data));
 }
开发者ID:andrinda,项目名称:myhotel,代码行数:10,代码来源:TypeController.php

示例2: index

 public function index()
 {
     $arrReturn = array();
     $typeObj = Type::where('short_name', Request::path())->first();
     $type_id = '1';
     // pr($typeObj);die;
     if (is_object($typeObj)) {
         $arrReturn['typeObj'] = $typeObj;
         $type_id = $typeObj->id;
     }
     $arrReturn['htmlPopularSearches'] = $this->loadPopularSearchImages();
     $arrReturn['htmlFeaturedCollections'] = $this->loadFeaturedCollections($type_id);
     $this->layout->content = View::make('frontend.types.index')->with($arrReturn);
 }
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:14,代码来源:TypeImagesController.php

示例3: getRate

 public function getRate($slug = '')
 {
     $type = Type::where('type', 'rate')->first();
     $posts = Post::where('type_id', '=', $type->id)->where('status', 1)->where('parent', '=', '0')->orderBy('created_at', 'desc')->get();
     $posts_child = Post::where('type_id', '=', $type->id)->where('status', 1)->where('parent', '!=', '0')->orderBy('created_at', 'desc')->get();
     if (!empty($slug)) {
         $row = Post::where('slug', $slug)->first();
         $posts_child = Post::where('type_id', '=', $type->id)->where('parent', $row->id)->where('status', 1)->orderBy('created_at', 'desc')->get();
         $blade = 'home.page-menu-title';
     } else {
         $tv = Rate::where('type', 'tv')->where('status', 1)->orderBy('position', 'asc')->get();
         $inet = Rate::where('type', 'inet')->first();
         $inetOption = Rate::where('type', 'inetOption')->where('status', 1)->orderBy('position', 'asc')->get();
         $row = array('inet' => json_decode($inet->description), 'inetOption' => $inetOption, 'tv' => $tv);
         $blade = 'home.page-rate';
     }
     $view = array('posts' => $posts, 'posts_child' => $posts_child, 'type' => $type, 'row' => $row);
     return View::make($blade, $view);
 }
开发者ID:ldin,项目名称:project_kartinki,代码行数:19,代码来源:HomeController.php

示例4: getCreateSitemap

 public function getCreateSitemap()
 {
     $urlroot = Config::get('app.url');
     $types = Type::where('status', 1)->get(array('type', 'updated_at', 'id'));
     $pages = Post::where('status', 1)->get(array('slug', 'updated_at', 'type_id'));
     // $project = Project::get(array('slug', 'updated_at'));
     // var_dump($urlroot); die();
     $xml = new DomDocument('1.0', 'utf-8');
     $urlset = $xml->createElement('urlset');
     $urlset->setAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
     foreach ($types as $type) {
         $url = $xml->createElement('url');
         $urlset->appendChild($url);
         $loc = $xml->createElement('loc');
         $url->appendChild($loc);
         $loc->appendChild($text = $xml->createTextNode($urlroot . '/' . $type->type));
         $lastmod = $xml->createElement('lastmod');
         $url->appendChild($lastmod);
         $lastmod->appendChild($xml->createTextNode(date('Y-m-d', strtotime($type->updated_at))));
         foreach ($pages as $post) {
             if ($post->type_id == $type->id) {
                 $url = $xml->createElement('url');
                 $urlset->appendChild($url);
                 $loc = $xml->createElement('loc');
                 $url->appendChild($loc);
                 $loc->appendChild($text = $xml->createTextNode($urlroot . '/' . $type->type . '/' . $post->slug));
                 $lastmod = $xml->createElement('lastmod');
                 $url->appendChild($lastmod);
                 $lastmod->appendChild($xml->createTextNode(date('Y-m-d', strtotime($post->updated_at))));
             }
         }
     }
     $xml->appendChild($urlset);
     $xml->formatOutput = true;
     $xml->save('sitemap.xml');
     if (!@fopen('sitemap.xml', "r")) {
         return Redirect::back()->with('error', 'ошибка при обновлении файла sitemap.xml');
     }
     return Redirect::back()->with('success', 'файл sitemap.xml обновлен');
     // return Response::download('sitemap.xml');
 }
开发者ID:ldin,项目名称:project_kartinki,代码行数:41,代码来源:AdminController.php

示例5: getType

 public function getType()
 {
     $q = Input::get('q');
     $data = Type::where('name', 'like', '%' . $q . '%')->orderBy('name', 'asc')->limit(10)->get();
     $array = array();
     foreach ($data as $row) {
         $array[] = array('id' => $row->id, 'text' => $row->name);
     }
     echo json_encode($array);
 }
开发者ID:andrinda,项目名称:myhotel,代码行数:10,代码来源:BookingController.php

示例6: item

 /**
  * Display detailed information about a specific item, including the icon,
  * description, price to buy in trade hubs and locally, and manufacturing costs
  * based on mineral prices in the local area.
  */
 public function item($id = NULL)
 {
     // Retrieve the basic information about this item.
     $type = Type::where('typeID', $id)->firstOrFail();
     // If material efficiency was updated, save to the database and set a local variable.
     $material_efficiency = $type->materialEfficiency;
     if (!isset($material_efficiency)) {
         $material_efficiency = new MaterialEfficiency();
         $material_efficiency->typeID = $id;
         $material_efficiency->materialEfficiency = 0;
     }
     if (Input::has('me')) {
         $material_efficiency->materialEfficiency = (int) Input::get('me');
     }
     // Save the updated material efficiency figure.
     $type->materialEfficiency()->save($material_efficiency);
     // Calculate volume if we need to use shipping data.
     $shipping_cost = Setting::where('key', 'shipping_cost')->first();
     $shipping_cost_to_include = 0;
     if ($shipping_cost->value > 0) {
         // If volume is below 1000, we assume it's not a ship hull and use the base volume.
         if ($type->volume < 1000) {
             $shipping_cost_to_include = $shipping_cost->value * $type->volume;
         } else {
             // For larger volumes, we need to use static values for ship types.
             switch ($type->groupID) {
                 case 31:
                     $shipping_cost_to_include = $shipping_cost->value * 500;
                     break;
                 case 25:
                 case 237:
                 case 324:
                 case 830:
                 case 831:
                 case 834:
                 case 893:
                     $shipping_cost_to_include = $shipping_cost->value * 2500;
                     break;
                 case 463:
                 case 543:
                     $shipping_cost_to_include = $shipping_cost->value * 3750;
                     break;
                 case 420:
                 case 541:
                     $shipping_cost_to_include = $shipping_cost->value * 5000;
                     break;
                 case 26:
                 case 358:
                 case 832:
                 case 833:
                 case 894:
                     $shipping_cost_to_include = $shipping_cost->value * 10000;
                     break;
                 case 28:
                     $shipping_cost_to_include = $shipping_cost->value * 20000;
                     break;
                 case 27:
                 case 381:
                     $shipping_cost_to_include = $shipping_cost->value * 50000;
                     break;
             }
         }
     }
     // Load the 64x64 icon to display.
     $icon = '';
     $ship = Ship::where('id', $id)->get();
     if (count($ship)) {
         $icon = 'https://image.eveonline.com/Render/' . $id . '_128.png';
     } elseif ($type->Group->Icon) {
         $icon = str_replace('_', '_64_', $type->MarketGroup->Icon->iconFile);
         $icon = preg_replace('/^0/', '', $icon);
         $icon = preg_replace('/0(.)$/', '$1', $icon);
         $icon = 'eve/items/' . $icon . '.png';
     }
     // Retrieve the current price ranges this item sells for.
     $response = API::eveCentral(array($id), Setting::where('key', 'home_region_id')->pluck('value'));
     $local_price = $response[$id];
     // Tech II items need to be treated differently.
     $t2_options = array();
     if ($type->metaType && $type->metaType->metaGroup && $type->metaType->metaGroup['metaGroupName'] == 'Tech II') {
         // Retrieve an array of different possibilities for decryptors.
         $tech_two = TechII::getInventionFigures($type);
         // For each decryptor, show the potential profit.
         $total_price = 1000000000;
         foreach ($tech_two as $decryptor) {
             // Default max runs is 10, add any modifier.
             $max_runs = 10;
             if (isset($decryptor['max_run_modifier'])) {
                 $max_runs += $decryptor['max_run_modifier'];
             }
             // Based on the chance of success, how many T2 items on average will be produced per run?
             $chance_of_success = $decryptor['chance_of_success'] / 100;
             $t2_items_per_blueprint = $max_runs * $chance_of_success;
             // Calculate the cost of manufacturing that many T2 items.
             $manufacturing_cost_per_blueprint = $t2_items_per_blueprint * ($decryptor['t2_manufacture_price'] * (100 - $decryptor['me_modifier']) / 100);
//.........这里部分代码省略.........
开发者ID:orbitroom,项目名称:eve-traders-handbook,代码行数:101,代码来源:DetailsController.php

示例7: 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


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