Esempio n. 1
0
 /**
  * 玩家情报首页
  */
 public function index()
 {
     // 取得全部卡片
     $lstCards = Card::all();
     // 取得全部装备
     $lstEquipments = Equipment::all();
     echo "PlayerId:" . $this->_intPlayerId . "<br />";
     echo "Name:" . $this->_lstPlayer["name"] . "<br />";
     echo "体力:" . $this->_lstPlayer["stamina"] . "/" . $this->_lstPlayer["max_stamina"] . "<br />";
     echo "Level:" . $this->_lstPlayer["level"] . "<br />";
     echo "Money:" . $this->_lstPlayer["money"] . "<br />";
     echo "Stone:" . $this->_lstPlayer["stone"] . "<br />";
     echo "<br />";
     echo "<a href='/game/player/team?player_id=" . $this->_intPlayerId . "&device_id=" . $this->_strDeviceId . "'>Team</a><br />";
     echo "<a href='/game/player/card-box?player_id=" . $this->_intPlayerId . "&device_id=" . $this->_strDeviceId . "'>CardBox</a><br />";
     echo "<a href='/game/player/equipment-box?player_id=" . $this->_intPlayerId . "&device_id=" . $this->_strDeviceId . "'>EquipmentBox</a><br />";
     echo "<br />";
     echo "<br />";
     echo "-----开发用-----<br />";
     echo "AllData:" . print_r($this->_lstPlayer, 1);
     echo "<br />";
     if (!empty($lstCards)) {
         echo "<br />";
         echo "赋予卡片:";
         echo "<form action='player/append-card' method='post'>";
         echo "<select name='card_id'>";
         foreach ($lstCards as $objCard) {
             echo "<option value=" . $objCard->id . ">" . $objCard->name_cn . "</option>";
         }
         echo "<input type='hidden' name='_token' value='" . csrf_token() . "'>";
         echo "<input type='hidden' name='player_id' value='" . $this->_intPlayerId . "'>";
         echo "<input type='submit' value='赋予'>";
         echo "</select>";
         echo "</form>";
     }
     if (!empty($lstEquipments)) {
         echo "赋予装备:";
         echo "<form action='player/append-equipment' method='post'>";
         echo "<select name='equipment_id'>";
         foreach ($lstEquipments as $objEquipment) {
             echo "<option value=" . $objEquipment->id . ">" . $objEquipment->name_cn . "</option>";
         }
         echo "<input type='hidden' name='_token' value='" . csrf_token() . "'>";
         echo "<input type='hidden' name='player_id' value='" . $this->_intPlayerId . "'>";
         echo "<input type='submit' value='赋予'>";
         echo "</select>";
         echo "</form>";
     }
 }
 public function run()
 {
     $faker = $this->getFaker();
     $orders = Order::all();
     $equipment = Equipment::all()->toArray();
     foreach ($orders as $order) {
         $used = [];
         for ($i = 0; $i < rand(1, 5); $i++) {
             $product = $faker->randomElement($equipment);
             if (!in_array($equipment["id"], $used)) {
                 $id = $equipment["id"];
                 $price = $equipment["price"];
                 $quantity = rand(1, 3);
                 OrderItem::create(["order_id" => $order->id, "equipment_id" => $id, "price" => $price, "quantity" => $quantity]);
                 $used[] = $equipment["id"];
             }
         }
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $equipment = Equipment::all();
     if (count($equipment) < 1) {
         return view('equipment.index', compact('equipment'));
     }
     $eq = $equipment->map(function ($item, $key) {
         return $item->id;
     });
     // Get today's range
     $now = new Carbon('now');
     $start = clone $now->hour(0)->minute(0)->second(0);
     $end = clone $now->hour(23)->minute(59)->second(59);
     $user = \Auth::id();
     $checkins = Checkin::whereIn('equipment_id', $eq)->where('user_id', $user)->whereBetween('checkin', [$start, $end])->whereNull('checkout')->get();
     foreach ($checkins as $ch) {
         $equipment->where('id', $ch->equipment_id)->first()->checked_in = true;
         $equipment->where('id', $ch->equipment_id)->first()->checkin = $ch->checkin;
     }
     return view('equipment.index', compact('equipment'));
 }
Esempio n. 4
0
 public function index()
 {
     $equipment = Equipment::all();
     $data = array('equipment' => $equipment);
     return view('components.equipment.equipment', $data);
 }
Esempio n. 5
0
 public function advice()
 {
     $equipment = Equipment::all();
     return view('auth.advice', compact('equipment'));
 }
Esempio n. 6
0
 public function all()
 {
     // 全部卡片JSON返回
     $equipments = Equipment::all();
     return Response::json($equipments);
 }
Esempio n. 7
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     return view('admin.equipment.equipment')->withAttrs(Attr::all())->withRaces(Race::all())->withJobs(Job::all())->withEquipments(Equipment::all())->withEquipmentTypes(EquipmentType::all())->withEquipmentSubTypes(EquipmentSubType::all())->withEquipmentStatuses(EquipmentStatus::all());
 }
 public function create()
 {
     $equipment = Equipment::all();
     return view('equipments.create', compact('equipment'));
 }