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


PHP Map::where方法代码示例

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


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

示例1: run

 public function run()
 {
     // Barracks Items
     $barracks = Map::where('location_name', 'barracks')->firstOrFail();
     Item::create(['name' => 'sword', 'map_id' => $barracks->id]);
     Item::create(['name' => 'armor', 'map_id' => $barracks->id]);
     Item::create(['name' => 'key', 'map_id' => $barracks->id]);
     // Southwest Tower Item
     $southWestTower = Map::where('location_name', 'southwest_tower_outer')->firstOrFail();
     Item::create(['name' => 'lantern', 'map_id' => $southWestTower->id]);
     // Kitchen Items
     $kitchen = Map::where('location_name', 'kitchen')->firstOrFail();
     Item::create(['name' => 'apple', 'map_id' => $kitchen->id]);
     Item::create(['name' => 'bread', 'map_id' => $kitchen->id]);
     // Reception Room Item
     $receptionRoom = Map::where('location_name', 'reception_room')->firstOrFail();
     Item::create(['name' => 'wine', 'map_id' => $receptionRoom->id]);
     // Wizard Tower Items
     $wizardTower = Map::where('location_name', 'wizard_tower')->firstOrFail();
     Item::create(['name' => 'potion_invisibility', 'map_id' => $wizardTower->id]);
     Item::create(['name' => 'potion_strength', 'map_id' => $wizardTower->id]);
     Item::create(['name' => 'potion_regeneration', 'map_id' => $wizardTower->id]);
     // Dressing Room Item
     $dressingRoom = Map::where('location_name', 'dressing_room')->firstOrFail();
     Item::create(['name' => 'gown', 'map_id' => $dressingRoom->id]);
     // Study Item
     $study = Map::where('location_name', 'study')->firstOrFail();
     Item::create(['name' => 'note', 'map_id' => $study->id]);
     // King Chamber Item
     $kingChamber = Map::where('location_name', 'king_chamber')->firstOrFail();
     Item::create(['name' => 'crown', 'map_id' => $kingChamber->id]);
 }
开发者ID:Borq-Gaming,项目名称:borq.dev,代码行数:32,代码来源:ItemsTableSeeder.php

示例2: isDead

 public function isDead()
 {
     $user = Auth::user();
     $health = $user->health;
     if ($health <= 0) {
         // move to game over room
         $update = Auth::user();
         $update->player_location_id = 22;
         $update->save();
         // fetch game over text
         $room = Map::where("id", 22)->firstOrFail();
         return $room->description;
     } else {
         return false;
     }
 }
开发者ID:Borq-Gaming,项目名称:borq.dev,代码行数:16,代码来源:TurnController.php

示例3: run

 public function run()
 {
     // Castle Entrance Guards
     $castleEntrance = Map::where('location_name', 'castle_entrance')->firstOrFail();
     Guard::create(['initial_health' => 10, 'map_id' => $castleEntrance->id]);
     Guard::create(['initial_health' => 10, 'map_id' => $castleEntrance->id]);
     // Barracks Guards
     $barracks = Map::where('location_name', 'barracks')->firstOrFail();
     Guard::create(['initial_health' => 10, 'map_id' => $barracks->id]);
     Guard::create(['initial_health' => 10, 'map_id' => $barracks->id]);
     Guard::create(['initial_health' => 10, 'map_id' => $barracks->id]);
     // North West Tower Guard
     $northWestTower = Map::where('location_name', 'northwest_tower')->firstOrFail();
     Guard::create(['initial_health' => 10, 'map_id' => $northWestTower->id]);
     // Outer Receiving Guard
     $outerReceiving = Map::where('location_name', 'outer_receiving')->firstOrFail();
     Guard::create(['initial_health' => 10, 'map_id' => $outerReceiving->id]);
     Guard::create(['initial_health' => 10, 'map_id' => $outerReceiving->id]);
 }
开发者ID:Borq-Gaming,项目名称:borq.dev,代码行数:19,代码来源:GuardsTableSeeder.php

示例4: fetchDescription

 public function fetchDescription($id)
 {
     $room = Map::where("id", $id)->firstOrFail();
     return $room->description;
 }
开发者ID:Borq-Gaming,项目名称:borq.dev,代码行数:5,代码来源:MoveController.php


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