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


PHP Recipe::with方法代码示例

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


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

示例1: view

 public function view($recipeCategorySlug, $recipeSlug)
 {
     $recipe = Recipe::with(array('recipeCategory' => function ($query) use($recipeCategorySlug) {
         $query->where('slug', '=', $recipeCategorySlug);
     }, 'otherRecipe1', 'otherRecipe2', 'products' => function ($query) {
         $query->take(1);
     }))->where('slug', '=', $recipeSlug)->live()->first();
     if (!$recipe) {
         \App::abort(404);
     }
     $product = current(current($recipe->products));
     return \View::make(\Config::get('laravel-food::views.recipes.view'))->with(compact('recipe', 'product'));
 }
开发者ID:fbf,项目名称:laravel-food,代码行数:13,代码来源:RecipesController.php

示例2: Get_Player_Workbench

 public function Get_Player_Workbench($db_id)
 {
     $web_prefs = PlayerAPIController::Get_Player_Webprefs($db_id);
     if ($web_prefs['show_workbench'] != 1) {
         return Response::json(array('status' => 'error', 'error' => 'Player is not allowing workbench viewing.'));
     } else {
         //Workbench Stuff
         $workbench_info = array();
         if (Cache::has($this->class_name . "_" . $db_id . "_Workbench")) {
             $workbench_info = Cache::get($this->class_name . "_" . $db_id . "_Workbench");
         } else {
             $wbinfo = Printer::where('db_id', '=', $player->db_id)->get();
             foreach ($wbinfo as $wb) {
                 $workbench_info[] = $wb->original;
             }
             Cache::forever($this->class_name . "_" . $db_id . "_Workbench", $workbench_info);
         }
         if (!empty($workbench_info)) {
             $workbench_info_blueprints = array();
             for ($i = 0; $i < count($workbench_info); $i++) {
                 //assume Medium health pack for large health packs, this is temporary till we can figure out whats going on with itemtypeid 85374
                 if ($workbench_info[$i]['blueprint_id'] == 85374) {
                     $workbench_info[$i]['blueprint_id'] = 75096;
                 }
                 $workbench_info_blueprints[] = $workbench_info[$i]['blueprint_id'];
             }
             $workbench_results = Recipe::with(array('outputs'))->where_in('itemtypeid', $workbench_info_blueprints)->get(array('itemtypeid', 'description', 'name'));
             $workbench_output_ids = array();
             $workbench_output_names = array();
             //at this point we will always have something in the workbench so don't worry about null
             foreach ($workbench_results as $workbench_result) {
                 if ($workbench_result->relationships['outputs'] != null) {
                     //add the output itemtypeid to the list
                     print_r($workbench_result->relationships['outputs']);
                 } else {
                     //add the blueprint_id as an itemtypeid because its a cert
                     $workbench_output_ids[] = $workbench_result->attributes['itemtypeid'];
                     if (strstr($workbench_result->attributes['description'], "Research")) {
                         $workbench_output_names[$workbench_result->attributes['itemtypeid']] = $workbench_result->attributes['description'];
                     } else {
                         $workbench_output_names[$workbench_result->attributes['itemtypeid']] = $workbench_result->attributes['name'];
                     }
                 }
             }
             unset($workbench_results);
             //get the icons
             $wb_icons = hWebIcon::where(function ($query) use($workbench_output_ids) {
                 $query->where('version', '=', Base_Controller::getVersionDate());
                 $query->where_in('itemTypeId', $workbench_output_ids);
             })->get(array('itemtypeid', 'asset_path'));
             foreach ($wb_icons as $wb) {
                 $workbench_output_icons[$wb->itemtypeid] = $wb->asset_path;
             }
             unset($wb_icons);
             //strip info & append info
             for ($i = 0; $i < count($workbench_info); $i++) {
                 unset($workbench_info[$i]['db_id']);
                 if (isset($workbench_info[$i]['id'])) {
                     unset($workbench_info[$i]['id']);
                 }
                 unset($workbench_info[$i]['created_at']);
                 unset($workbench_info[$i]['updated_at']);
                 unset($workbench_info[$i]['blueprint_id']);
                 if (isset($workbench_output_ids[$i])) {
                     $workbench_info[$i]['item'] = $workbench_output_names[$workbench_output_ids[$i]];
                 } else {
                     $workbench_info[$i]['item'] = 'Undefined';
                 }
                 if (isset($workbench_output_icons[$i])) {
                     $workbench_info[$i]['icon'] = $workbench_output_icons[$workbench_results->attributes['itemtypeid']];
                 } else {
                     $workbench_info[$i]['icon'] = "";
                 }
             }
         }
         $workbench_info['status'] = 'success';
         return json_encode($workbench_info);
     }
 }
开发者ID:odie5533,项目名称:ThumpDumpDB,代码行数:79,代码来源:PlayerAPIController.php

示例3: get_player_certs


//.........这里部分代码省略.........
                 $base_biotech_items = $cached_can_craft['base_biotech_items'];
                 $base_dreadnaught_items = $cached_can_craft['base_dreadnaught_items'];
                 $base_engineer_items = $cached_can_craft['base_engineer_items'];
                 $base_recon_items = $cached_can_craft['base_recon_items'];
                 $base_firecat_items = $cached_can_craft['base_firecat_items'];
                 $base_tigerclaw_items = $cached_can_craft['base_tigerclaw_items'];
                 $base_dragonfly_items = $cached_can_craft['base_dragonfly_items'];
                 $base_recluse_items = $cached_can_craft['base_recluse_items'];
                 $base_rhino_items = $cached_can_craft['base_rhino_items'];
                 $base_mammoth_items = $cached_can_craft['base_mammoth_items'];
                 $base_arsenal_items = $cached_can_craft['base_arsenal_items'];
                 $base_electron_items = $cached_can_craft['base_electron_items'];
                 $base_bastion_items = $cached_can_craft['base_bastion_items'];
                 $base_nighthawk_items = $cached_can_craft['base_nighthawk_items'];
                 $base_raptor_items = $cached_can_craft['base_raptor_items'];
             }
         }
     }
     if ($web_prefs['show_workbench']) {
         //Workbench Stuff
         $workbench_info = array();
         if (Cache::has($player->db_id . '_printer')) {
             $workbench_info = Cache::get($player->db_id . '_printer');
         } else {
             $wbinfo = Printer::where('db_id', '=', $player->db_id)->get();
             foreach ($wbinfo as $wb) {
                 $workbench_info[] = $wb->original;
             }
             Cache::forever($player->db_id . '_printer', $workbench_info);
         }
         if (!empty($workbench_info)) {
             $workbench_info_blueprints = array();
             for ($i = 0; $i < count($workbench_info); $i++) {
                 $workbench_info_blueprints[] = $workbench_info[$i]['blueprint_id'];
             }
             $workbench_results = Recipe::with(array('outputs'))->where_in('itemtypeid', $workbench_info_blueprints)->get(array('itemtypeid', 'description', 'name'));
             $workbench_output_ids = array();
             $workbench_output_names = array();
             //at this point we will always have something in the workbench so don't worry about null
             foreach ($workbench_results as $workbench_result) {
                 if ($workbench_result->relationships['outputs'] != null) {
                     //add the output itemtypeid to the list
                     print_r($workbench_result->relationships['outputs']);
                 } else {
                     //add the blueprint_id as an itemtypeid because its a cert
                     $workbench_output_ids[] = $workbench_result->attributes['itemtypeid'];
                     if (strstr($workbench_result->attributes['description'], "Research")) {
                         $workbench_output_names[$workbench_result->attributes['itemtypeid']] = $workbench_result->attributes['description'];
                     } else {
                         $workbench_output_names[$workbench_result->attributes['itemtypeid']] = $workbench_result->attributes['name'];
                     }
                 }
             }
             unset($workbench_results);
             //get the icons
             $wb_icons = hWebIcon::where(function ($query) use($workbench_output_ids) {
                 $query->where('version', '=', Base_Controller::getVersionDate());
                 $query->where_in('itemTypeId', $workbench_output_ids);
             })->get(array('itemtypeid', 'asset_path'));
             foreach ($wb_icons as $wb) {
                 $workbench_output_icons[$wb->itemtypeid] = $wb->asset_path;
             }
             unset($wb_icons);
         }
     }
     //ShipIt(TM)
     $response = View::make('player.player_profile_store')->with('title', 'Player Store for ' . $playerName)->with(compact('web_prefs'))->with(compact('player'))->with(compact('army'));
     if (!empty($progress)) {
         $response->progress = $progress;
         $response->base_shared_items = $base_shared_items;
         $response->base_assault_items = $base_assault_items;
         $response->base_biotech_items = $base_biotech_items;
         $response->base_dreadnaught_items = $base_dreadnaught_items;
         $response->base_engineer_items = $base_engineer_items;
         $response->base_recon_items = $base_recon_items;
         $response->base_firecat_items = $base_firecat_items;
         $response->base_tigerclaw_items = $base_tigerclaw_items;
         $response->base_dragonfly_items = $base_dragonfly_items;
         $response->base_recluse_items = $base_recluse_items;
         $response->base_rhino_items = $base_rhino_items;
         $response->base_mammoth_items = $base_mammoth_items;
         $response->base_arsenal_items = $base_arsenal_items;
         $response->base_electron_items = $base_electron_items;
         $response->base_bastion_items = $base_bastion_items;
         $response->base_nighthawk_items = $base_nighthawk_items;
         $response->base_raptor_items = $base_raptor_items;
     }
     if (!empty($market_listings)) {
         $response->market_listings = $market_listings;
         if (!empty($item_stats_lookup)) {
             $response->stats = $item_stats_lookup;
         }
     }
     if (!empty($workbench_info)) {
         $response->workbench_info = $workbench_info;
         $response->workbench_output_icons = $workbench_output_icons;
         $response->workbench_output_names = $workbench_output_names;
     }
     return $response;
 }
开发者ID:odie5533,项目名称:ThumpDumpDB,代码行数:101,代码来源:player_stores.php


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