public function insertProfileDetail($post_detail) { $Characterprofile = new Characterprofile(); $character_id = Characterprofile::where('username', $post_detail['username'])->first(); if (!empty($character_id)) { $row = $character_id; } else { $row = $Characterprofile; } foreach ($post_detail as $key => $value) { $row->{$key} = $value; } return $row->save(); }
private function updateCharacterProfile($uid, $char) { $character_id = Characterprofile::where('char_id', $char['characterID'])->first(); if (!empty($character_id)) { $row = $character_id; } else { $row = new Characterprofile(); } $row->uid = $uid; $row->char_id = $char['characterID']; $row->username = $char['name']; $row->corporation = $char['corporationName']; $row->alliance = $char['allianceName']; $row->status = 1; $row->save(); }