public static function getprofile($id, $value) { $profiles = Member::where('id', '=', $id)->get(); foreach ($profiles as $record) { $vdata = $record->{$value}; } if ($value == 'education') { $education = education::orderBy('id')->get(); foreach ($education as $recode) { if ($vdata == $recode->id) { echo $recode->name; } } } else { if ($value == 'bank') { $bank = bank::orderBy('id')->get(); foreach ($bank as $recode) { if ($vdata == $recode->id) { echo $recode->name; } } } else { if ($value == 'province') { $province = province::orderBy('id')->get(); foreach ($province as $recode) { if ($vdata == $recode->id) { echo $recode->name; } } } else { if ($value == 'district') { $district = district::orderBy('name')->get(); foreach ($district as $recode) { if ($vdata == $recode->id) { echo $recode->name; } } } else { if ($value == 'birthday' && !empty($vdata)) { $split_birthday = explode("-", $vdata); $vdata = $split_birthday[2] . "/" . $split_birthday[1] . "/" . $split_birthday[0]; echo $vdata; } else { echo $vdata; } } } } } }
public static function get_distric_select() { $districts = district::orderBy('name')->get(); $return_data = ""; foreach ($districts as $distric) { $return_data .= "<option value=" . $distric->id . ">" . $distric->name . "</option>"; } echo $return_data; }
public static function district($id, $type) { if ($type == 'edit') { $user = Member::where("id", "=", $id)->first(); $id = $user->district; } $district = district::orderBy('name')->get(); echo "<select name='district' id='district' class='form-control'><option value='0'>none</option>"; foreach ($district as $recode) { echo "<option value='" . $recode->id . "'"; if ($id == $recode->id) { echo " selected='selected'"; } echo ">" . $recode->name . "</option>"; } echo "</select>"; }