/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { return view('admin.skill.show')->withSkill(Skill::find($id))->withCards(Card::where('skill_id', $id)); }
public function get_cards($deck_id = 3, $type_id = 1) { $cards = new Card(); $cards->where('deck_id', $deck_id)->order_by('id', 'RANDOM')->where('type_id', $type_id)->get(); $this->data['cards'] = $cards; $array = array(); foreach ($cards as $card) { array_push($array, array('id' => $card->id, 'data' => $card->data, 'cards' => $card->card_amount)); } echo json_encode($array); }