public function combobox() { $q = Input::get("q"); $p = DBWOGCharacter::where('ch_name', 'like', "%{$q}%")->get(); foreach ($p as $k => $d) { $p[$k] = ['value' => $d['ch_id'], 'text' => "({$d['ch_id']}) {$d['ch_name']}"]; } return Response::json($p); }
public function afterValidation(&$data) { $ex = DBWOGCharacterSkill::find($data['s_id']); if ($data['pkval'] && $ex && $data['pkval'] != $data['s_id']) { Response::alert("ID重複"); } $ch = DBWOGCharacter::find($data['ch_id']); if (!$ch) { Response::alert("職業(ch_id={$data['ch_id']})不存在"); } if ($data['main_sid'] > 0) { $s = DBWOGCharacterSkill::find($data['main_sid']); if (!$s) { Response::alert("親技能(s_id={$data['main_sid']})不存在"); } } if ($data['need_sid'] > 0) { $s = DBWOGCharacterSkill::find($data['need_sid']); if (!$s) { Response::alert("前置技能(s_id={$data['need_sid']})不存在"); } } }