public function index() { // $current_user = Auth::user(); $data = Card::all()->where('user_id', $current_user['id']); return $data; // return json_encode(array('hey')); }
/** * 玩家卡片取得处理 */ public function cardBox() { // 玩家ID获取 $intPlayerId = Input::get('player_id'); // 玩家所持卡片全取得 $lstCard = OwnedCard::where('player_id', $intPlayerId)->get(); return view('admin.player.card-box')->withCards(Card::all())->withAttrs(Attr::all())->withRaces(Race::all())->withJobs(Job::all())->withSkills(Skill::all())->withOwnedCards($lstCard); }
/** * ajax endpoint that spits out all the cards in the database as * JSON encoded string * * Note that the naming convention and how it translates: * getAllAsJson will be all-as-json in the URL * */ public function getAllAsJson() { // grab all the cards $cards = \App\Card::all(); // encode as json $cards = json_encode($cards); // return the encoded data return $cards; }
/** * 新建卡片页面 * @return mixed */ public function create() { // 职业 $intJob = Input::get('job', 1); // 稀有度 $intRare = Input::get('rare', 1); // 生成数据的类型 $intParamType = Input::get('param_type', 1); // 内部数据计算 $lstParams = Card::calcParams($intJob, $intRare, $intParamType); // 评分 $lstScore = Card::calcScore($lstParams); return view('admin.card.create')->withParams($lstParams)->withScore($lstScore)->withCards(Card::all())->withAttrs(Attr::all())->withRaces(Race::all())->withJobs(Job::all())->withSkills(Skill::all()); }
/** * 玩家情报首页 */ 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>"; } }
/** * заполнение таблицы пранзакций */ private function transactionsTable() { Transaction::truncate(); $u = User::count(); $c = Card::count(); $i = 0; while ($i < 10) { ++$i; Transaction::create(['user_id' => rand(1, $u), 'card_id' => rand(1, $c), 'money' => rand(0, 1000)]); } $crd = Card::all(); foreach ($crd as $v) { $v->balance = Transaction::where('card_id', $v->id)->sum('money'); $v->save(); } }
/** * 取得全部卡片的JSON * * @return Response JSON */ public function cards() { $cards = Card::all(); return Response::json($cards); }
/** * Execute the console command. * * @return mixed */ public function handle() { Card::all()->each(function ($card) { $this->dispatch(new RequestBalanceForCard($card)); }); }
public function index() { $cards = Card::all(); return view('cards.index', compact('cards')); }
/** * Display a listing of the resource. * * @param Request $request * * @return Response */ public function index(Request $request) { $cards = Card::all(); return $this->respond(fractal()->collection($cards, new CardTransformer())->parseIncludes($request->input('include', []))->toArray()); }
public function index() { // $cards = DB::table('cards')->get(); $cards = Card::all(); return view('cards.index', compact('cards')); }
public function all() { // 全部卡片JSON返回 $cards = Card::all(); return Response::json($cards); }
public function index() { $cards = Card::all(); return $cards; }
/** * 创建地下城敌人 * @param $intDungeonId * @return mixed */ public function enemyCreate($intDungeonId) { return view('admin.dungeon.enemy-create')->withCards(Card::all())->withDungeon(Dungeon::find($intDungeonId)); }
public function getAll() { /** @var json $return */ $return = Card::all(); return $return; }
public function getNapthe() { $cards = Card::all(); return view('frontend.user.card')->with(compact('cards')); }