/** * Store a newly created resource in storage. * * @return Response */ public function store() { $lskill = new Lskill(); // skill Model 内容 $lskill->name_jp = Input::get('name_jp'); $lskill->name_en = Input::get('name_en'); $lskill->name_cn = Input::get('name_cn'); $lskill->desc_jp = Input::get('desc_jp'); $lskill->desc_en = Input::get('desc_en'); $lskill->desc_cn = Input::get('desc_cn'); $lskill->race = Input::get('race'); $lskill->attr = Input::get('attr'); $lskill->job = Input::get('job'); $lskill->power = Input::get('power'); $lskill->power_type = Input::get('power_type'); $lskill->admin_memo = Input::get('admin_memo'); // 原则上做成时非公开 $lskill->open = false; // $lskill->update_datetime = now(); if ($lskill->save()) { return Redirect::to('skill'); } else { return Redirect::back()->withInput()->withErrors('保存失败!'); } }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { // $card = Card::find($id); if (!$card) { // 无对应卡片数据 } $skill = null; if ($card->skill_id != 0) { $skill = Skill::where("skill_id", $card->skill_id)->first(); } $lskill = null; if ($card->lskill_id != 0) { $lskill = Lskill::where("lskill_id", $card->lskill_id)->first(); } $objEvoTargetCard = null; $objMaterial1Card = null; $objMaterial2Card = null; $objMaterial3Card = null; $objMaterial4Card = null; if ($card->evo_id != 0) { $objEvoTargetCard = Card::where("card_id", $card->evo_id)->first(); if ($card->material_id1 > 0) { $objMaterial1Card = Card::where("card_id", $card->material_id1)->first(); } if ($card->material_id2 > 0) { $objMaterial2Card = Card::where("card_id", $card->material_id2)->first(); } if ($card->material_id3 > 0) { $objMaterial3Card = Card::where("card_id", $card->material_id3)->first(); } if ($card->material_id4 > 0) { $objMaterial4Card = Card::where("card_id", $card->material_id4)->first(); } } return view('card.show')->withCard($card)->withSkill($skill)->withLskill($lskill)->withTitle($card->name_jp)->withAbilities(Ability::all())->withType1s(Type1::all())->withType2s(Type2::all())->withEvoTargetCard($objEvoTargetCard)->withMaterial1Card($objMaterial1Card)->withMaterial2Card($objMaterial2Card)->withMaterial3Card($objMaterial3Card)->withMaterial4Card($objMaterial4Card)->withAttrs(Attr::all()); }
/** * 取得全部队长技能的JSON * * @return Response JSON */ public function lskills() { $lskills = Lskill::all(); return Response::json($lskills); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $lskill = Lskill::find($id); if ($lskill->delete()) { return Redirect::to('admin/lskill#add_area'); } else { return Redirect::back()->withInput()->withErrors('删除技能失败!'); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { // $card = Card::find($id); return view('admin.card.edit')->withCard(Card::find($id))->withSkills(Skill::all())->withLskills(Lskill::all())->withAbilities(Ability::all())->withType1s(Type1::all())->withType2s(Type2::all())->withAttrs(Attr::all()); }