public static function New_Assign($assign_id) { $root_url = dirname($_SERVER['PHP_SELF']); $root_url = "http://ojconsultinggroup.com" . $root_url; $assingment = Assignment::where("id", "=", $assign_id)->first(); $user = Member::where("id", "=", $assingment->user_id)->first(); $event = event::where("id", "=", $assingment->event_id)->first(); $customer_id = $event->customer_id; $venue_id = $event->venue_id; $venue_room = venue::where("id", "=", $venue_id)->first(); $customer = customer::where("id", "=", $customer_id)->first(); $userid = $user->id; $idcard = $user->id_card; $name = $user->name . " " . $user->surname; $email = $user->email; $event_name = $event->event_name; $event_type = $event->event_type; $split_event_date = explode("-", $event->event_date); $event_date = $split_event_date[2] . " " . AssignCalendar::get_month_thai($split_event_date[1]) . " " . AssignCalendar::get_BE_year($split_event_date[0]); $staff_appointment_time = $event->staff_appointment_time; $customer_name = $customer->symbol . " - " . $customer->name; $venue_name = $venue_room->venue->name . " : " . $venue_room->room_name; $venue_address = $venue_room->venue->address; $subject = "OJ - คุณได้รับมอบหมายงานในวันที่ " . $event_date; $data = array('root_url' => $root_url, 'userid' => $userid, 'idcard' => $idcard, 'id' => $assign_id, 'name' => $name, 'event_name' => $event_name, 'event_type' => $event_type, 'event_date' => $event_date, 'staff_appointment_time' => $staff_appointment_time, 'customer_name' => $customer_name, 'venue_name' => $venue_name, 'venue_address' => $venue_address, 'subject' => $subject, 'email' => $email); Mail::queue('Assign.New_assign_mail', $data, function ($message) use($data) { $message->to($data['email'])->subject($data['subject']); }); }
public function index() { //$members = Member::all('*', 10); //$members = Member::where('email', 'LIKE', '%joko%')->get(); //$members = Member::first(); $members = Member::byId('M1411190001'); echo '<pre>'; print_r($members); echo '</pre>'; Member::where('member_id', 'M1411190001')->update(array('postcode' => '41234')); }
public function show($validate = 1, $active = 1) { $now = Carbon::now(); if ($active == 1) { $members = Member::where('Validated', $validate)->where('MemberExpiredDate', '>', $now)->get(); } else { $members = Member::where('Validated', $validate)->where('MemberExpiredDate', '<', $now)->get(); } $kode = $validate == 1 ? $active == 1 ? 1 : 3 : 2; $this->view->render('admin/member', ['members' => $members, 'kode' => $kode, 'petugas' => $this->petugas]); }
public static function reset() { if (Request::input('rs_type') == "change") { $validate = validateuser::validatechangepass(Request::all()); if ($validate->passes()) { $user = Member::where("id", "=", Request::input('id'))->first(); $dbpass = $user->password; $passcheck = \Hash::check(Request::input('old_password'), $dbpass); if ($passcheck == TRUE) { $user->password = \Hash::make(Request::input('password')); if ($user->save()) { return Redirect::to('user_profile')->with('status', 'Change password has been completed'); } } else { return redirect()->back()->withErrors('Old Password is Wrong!'); } } else { return redirect()->back()->withErrors($validate->messages()); } } else { if (Request::input('rs_type') == "forgot") { $validate = validateuser::validateforgotpass(Request::all()); if ($validate->passes()) { //get email from server $user = Member::where("id", "=", Request::input('id'))->first(); $email = $user->email; //get key from server $reset = Reset::where("email", "=", $email)->first(); $key = $reset->token; //Check email match if ($email == Request::input('email')) { //Check key match if ($key == Request::input('key')) { $user->password = \Hash::make(Request::input('password')); //Change completed if ($user->save()) { return Redirect::to('login')->with('status', 'Change password has been completed'); } } else { return redirect()->back()->withErrors('key is Wrong! Please resend forgot password.'); } } else { return redirect()->back()->withErrors('email is Wrong!'); } } else { return redirect()->back()->withInput(Request::except('password'))->withErrors($validate->messages()); } } else { //Not match all } } }
public static function get_user_data($user_id, $value) { $count_member = Member::where('id', '=', $user_id)->count(); if ($count_member > 0) { $user = Member::where('id', '=', $user_id)->first(); if ($value == "fullname") { $return_data = $user->nickname . " - " . $user->name . " " . $user->surname; } else { $return_data = $user->{$value}; } return $return_data; } }
public function postLogin(Request $request) { $messages = ['email.required' => 'กรุณาใส่อีเมล์', 'email.email' => 'กรุณาใส่อีเมล์ให้ถูกต้อง', 'email.exists' => 'ไม่มีอีเมล์ดังกล่าวในระบบ', 'password.required' => 'กรุณาใส่พาสเวิร์ด']; $validator = Validator::make($request->all(), ['email' => 'required|email|exists:ch_member,email', 'password' => 'required'], $messages); //$request->session()->put('data', 'value'); if ($validator->fails()) { return redirect()->back()->withErrors($validator)->withInput(); } $member = \App\Models\Member::where("email", "=", $request->email)->first(); if (Hash::check($request->password, $member->password)) { $request->session()->put('member', $member); } else { return redirect()->back()->withErrors(['พาสเวิร์ดหรืออีเมล์ของคุณไม่สัมพันธ์กัน'])->withInput(); } return redirect('/member'); }
public function sendEmailReminder() { $validate = validateuser::validateforgot(Request::all()); if ($validate->passes()) { $count = Member::where('email', '=', Request::input('email'))->count(); if ($count == 1) { $forgot_code = sendmail::generateRandomString(); $sforgot_code = MD5($forgot_code); Mail::send('Member.mailforgot', array('code' => $sforgot_code), function ($message) { $message->to(Request::input('email'))->subject('Your Reminder!'); }); return redirect::to('/'); } else { $msg = "Not found email!"; return redirect::to('forgot')->withInput(Request::except('password'))->withErrors($msg); } } else { return redirect::to('forgot')->withInput(Request::except('password'))->withErrors($validate->messages()); } }
public function sendEmailForgot() { $validate = validateuser::validateforgot(Request::all()); if ($validate->passes()) { $count = Member::where('email', '=', Request::input('email'))->count(); if ($count == 1) { $forgot_code = sendmail::generateRandomString(); $sforgot_code = MD5($forgot_code); $countforgot = Reset::where('email', '=', Request::input('email'))->count(); if ($countforgot == 1) { $reset = Reset::where("email", "=", Request::input('email'))->first(); $reset->token = $sforgot_code; $reset->save(); } else { $reset = new Reset(); $reset->email = Request::input('email'); $reset->token = $sforgot_code; $reset->save(); } $profiles = Member::where('email', '=', Request::input('email'))->get(); foreach ($profiles as $record) { $name = $record->name; $id = $record->id; } $email = Request::input('email'); $link = 'http://www.ojconsultinggroup.com/4oj/reset/' . $id . '/token/' . $sforgot_code; $data = array('code' => $sforgot_code, 'name' => $name, 'link' => $link); Mail::queue('Member.mailforgot', $data, function ($message) use($email, $data) { $message->to($email)->subject('Your Password Reset Link!'); }); return Redirect::to('forgot')->with('status', 'อีเมลสำหรับตั้งรหัสผ่านใหม่ได้ถูกส่งไปแล้ว'); } else { $msg = "เกิดข้อผิดพลาด! ไม่พบชื่ออีเมลนี้ในระบบ"; return Redirect::to('forgot')->withInput(Request::except('password'))->withErrors($msg); } } else { return Redirect::to('forgot')->withInput(Request::except('password'))->withErrors($validate->messages()); } }
dd($memberThatHasDocuments); }); Route::get('eager', function () { $members = Member::get(); $members->load('documents'); foreach ($members as $member) { $member->documents; } }); Route::get('morph', function () { // Student::create(['name' => 'Mahasiswa']); // Lecturer::create(['name' => 'Dosen']); $mahasiswa = Student::first(); $dosen = Lecturer::first(); $saya = Member::where('name', 'Saya')->first(); $kamu = Member::where('name', 'Kamu')->first(); $dosen->member()->save($saya); $mahasiswa->member()->save($kamu); dump($kamu->person); dump($saya->person); }); Route::get('coba_asset', function () { // Asset::create(['name' => 'meja']); // Asset::create(['name' => 'kursi']); // Asset::create(['name' => 'lemari']); $member = Member::first(); $assets = Asset::get(); $array = [1, 2, 3, 4]; $collection = collect($array); $reverse = $collection->reverse(); $asset_ids = $assets->pluck('id')->all();
public static function report_request_job($filter_group, $filter_value, $sort, $user_id_filter) { if ($user_id_filter != 'null') { $filter_group = '1'; } $root_url = dirname($_SERVER['PHP_SELF']); //=========================================================================================== if ($filter_group == 'all') { $request = request_job::orderBy('start_date')->get(); $returndata = ""; $returndata .= "<div class='row'>\n <div class='col-lg-12'>\n <div class='table-responsive'>\n <p>จำนวนรายการร้องขอทำงานทั้งหมด : " . count($request) . "</p>\n <table class='table table-bordered table-hover table-striped'>\n <thead>\n <tr>\n <th class='text-center'>ชื่อผู้ร้องขอ</th>\n <th class='text-center'>วันเริ่ม</th>\n <th class='text-center'>วันสิ้นสุด</th>\n <th class='text-center'>ช่วงเวลา</th>\n <th class='text-center'>ชื่อกิจกรรม</th>\n <th class='text-center'>หมายเหตุ</th>\n </tr>\n </thead>\n <tbody>"; foreach ($request as $row) { $user = Member::where("id", "=", $row->user_id)->first(); $user_id = $user->id; $user_name = $user->nickname . "-" . $user->name . " " . $user->surname; $split_start_date = explode("-", $row->start_date); $start_date = $split_start_date[2] . "/" . $split_start_date[1] . "/" . $split_start_date[0]; $split_end_date = explode("-", $row->end_date); $end_date = $split_end_date[2] . "/" . $split_end_date[1] . "/" . $split_end_date[0]; if ($row->duration == 1) { $duration = "ทั้งวัน"; } else { if ($row->duration == 2) { $duration = "ช่วงเช้า"; } else { if ($row->duration == 3) { $duration = "ช่วงบ่าย"; } } } $event_id = ""; $event_name = ""; if ($row->event_id != 0) { $event = event::where("id", "=", $row->event_id)->first(); $event_id = $event->id; $event_name = $event->event_name; } $returndata .= "<tr>\n <td class=''><a target='_blank' href='" . $root_url . "/profile_admin/" . $user_id . "'>" . $user_name . "</a></td>\n <td class='text-center'>" . $start_date . "</td>\n <td class='text-center'>" . $end_date . "</td>\n <td class='text-center'>" . $duration . "</td>\n <td class='text-center'><a href='" . $root_url . "/event_detail/" . $event_id . "'>" . $event_name . "</a></td>\n <td>" . $row->remark . "</td>\n </tr>"; } $returndata .= "</tbody>\n </table>\n </div>\n </div>\n </div>"; } else { if ($filter_group == '1') { if ($user_id_filter != 'null') { $query_user = $user_id_filter; } else { $query_user_splite1 = explode("[", $filter_value); $query_user_splite2 = explode("]", $query_user_splite1[1]); $query_user = $query_user_splite2[0]; } $request = request_job::where("user_id", "=", $query_user)->orderBy('start_date')->get(); $returndata = ""; $returndata .= "<div class='row'>\n <div class='col-lg-12'>\n <div class='table-responsive'>\n <p>จำนวนรายการร้องขอทำงานทั้งหมด : " . count($request) . "</p>\n <table class='table table-bordered table-hover table-striped'>\n <thead>\n <tr>\n <th class='text-center'>ชื่อผู้ร้องขอ</th>\n <th class='text-center'>วันเริ่ม</th>\n <th class='text-center'>วันสิ้นสุด</th>\n <th class='text-center'>ช่วงเวลา</th>\n <th class='text-center'>ชื่อกิจกรรม</th>\n <th class='text-center'>หมายเหตุ</th>\n </tr>\n </thead>\n <tbody>"; foreach ($request as $row) { $user = Member::where("id", "=", $row->user_id)->first(); $user_id = $user->id; $user_name = $user->nickname . "-" . $user->name . " " . $user->surname; $split_start_date = explode("-", $row->start_date); $start_date = $split_start_date[2] . "/" . $split_start_date[1] . "/" . $split_start_date[0]; $split_end_date = explode("-", $row->end_date); $end_date = $split_end_date[2] . "/" . $split_end_date[1] . "/" . $split_end_date[0]; if ($row->duration == 1) { $duration = "ทั้งวัน"; } else { if ($row->duration == 2) { $duration = "ช่วงเช้า"; } else { if ($row->duration == 3) { $duration = "ช่วงบ่าย"; } } } $event_id = ""; $event_name = ""; if ($row->event_id != 0) { $event = event::where("id", "=", $row->event_id)->first(); $event_id = $event->id; $event_name = $event->event_name; } $returndata .= "<tr>\n <td class=''><a target='_blank' href='" . $root_url . "/profile_admin/" . $user_id . "'>" . $user_name . "</a></td>\n <td class='text-center'>" . $start_date . "</td>\n <td class='text-center'>" . $end_date . "</td>\n <td class='text-center'>" . $duration . "</td>\n <td class='text-center'><a href='" . $root_url . "/event_detail/" . $event_id . "'>" . $event_name . "</a></td>\n <td>" . $row->remark . "</td>\n </tr>"; } $returndata .= "</tbody>\n </table>\n </div>\n </div>\n </div>"; } else { if ($filter_group == '2') { $input_date = explode("/", $filter_value); $date = $input_date[2] . "-" . $input_date[1] . "-" . $input_date[0]; $request = request_job::where("start_date", "<=", $date)->where("end_date", ">=", $date)->orderBy('start_date')->get(); $returndata = ""; $returndata .= "<div class='row'>\n <div class='col-lg-12'>\n <div class='table-responsive'>\n <p>จำนวนรายการร้องขอทำงานทั้งหมด : " . count($request) . "</p>\n <table class='table table-bordered table-hover table-striped'>\n <thead>\n <tr>\n <th class='text-center'>ชื่อผู้ร้องขอ</th>\n <th class='text-center'>วันเริ่ม</th>\n <th class='text-center'>วันสิ้นสุด</th>\n <th class='text-center'>ช่วงเวลา</th>\n <th class='text-center'>ชื่อกิจกรรม</th>\n <th class='text-center'>หมายเหตุ</th>\n </tr>\n </thead>\n <tbody>"; foreach ($request as $row) { $user = Member::where("id", "=", $row->user_id)->first(); $user_id = $user->id; $user_name = $user->nickname . "-" . $user->name . " " . $user->surname; $split_start_date = explode("-", $row->start_date); $start_date = $split_start_date[2] . "/" . $split_start_date[1] . "/" . $split_start_date[0]; $split_end_date = explode("-", $row->end_date); $end_date = $split_end_date[2] . "/" . $split_end_date[1] . "/" . $split_end_date[0]; if ($row->duration == 1) { $duration = "ทั้งวัน"; } else { if ($row->duration == 2) { $duration = "ช่วงเช้า"; } else { if ($row->duration == 3) { $duration = "ช่วงบ่าย"; } } } $event_id = ""; $event_name = ""; if ($row->event_id != 0) { $event = event::where("id", "=", $row->event_id)->first(); $event_id = $event->id; $event_name = $event->event_name; } $returndata .= "<tr>\n <td class=''><a target='_blank' href='" . $root_url . "/profile_admin/" . $user_id . "'>" . $user_name . "</a></td>\n <td class='text-center'>" . $start_date . "</td>\n <td class='text-center'>" . $end_date . "</td>\n <td class='text-center'>" . $duration . "</td>\n <td class='text-center'><a href='" . $root_url . "/event_detail/" . $event_id . "'>" . $event_name . "</a></td>\n <td>" . $row->remark . "</td>\n </tr>"; } $returndata .= "</tbody>\n </table>\n </div>\n </div>\n </div>"; } } } //=============================================================================================== echo $returndata; }
/** * Get User's session * * @param string $userKey * @param bool $create * @return Member */ private static function getUser($userKey = null, $create = false) { $session = session(); $user = null; if ($userKey) { $user = Member::where(['key' => $userKey])->first(); if (!$user && $create && Member::getAutoLicense(Site::getName())) { $user = Member::create(['key' => $userKey, 'first_name' => Site::getName() . ' user']); $user->createAutoLicense(Site::getName()); } if ($user) { $session->put('tool.user', $user->key); } } else { if ($session->has('tool.user')) { $userKey = $session->get('tool.user'); $user = Member::where(['key' => $userKey])->first(); } } return $user; }
public function getByActivation($code) { $user = Member::where('activation_code', $code)->first(); return $user; }
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>"; }
public static function get_OJ_contact($id, $value) { $event = event::where("id", "=", $id)->first(); $userid = $event->staff_contact_id; $user = Member::where("id", "=", $userid)->first(); if ($value == "name") { $datareturn = $user->nickname . " - " . $user->name . " " . $user->surname; } else { $datareturn = $user->{$value}; } return $datareturn; }
public static function updateuser() { $validate = validateuser::validateupdateuser(Request::all()); if ($validate->passes()) { $address_id = Request::input('address_id'); if (Request::input('address_id_checkbox') == true) { $address_id = Request::input('address'); } $input_birthday = explode("/", Request::input('birthday')); $birthday = $input_birthday[2] . "-" . $input_birthday[1] . "-" . $input_birthday[0]; $user = Member::where("id", "=", Request::input('id'))->first(); $user->name = Request::input('name'); $user->surname = Request::input('surname'); $user->nickname = Request::input('nickname'); $user->phone = Request::input('phone'); $user->bank = Request::input('bank'); $user->account_no = Request::input('account'); $user->education = Request::input('education'); $user->institute = Request::input('institute'); $user->reference = Request::input('reference'); $user->address = Request::input('address'); $user->province = Request::input('province'); $user->birthday = $birthday; $user->lineid = Request::input('lineid'); $user->address_id = $address_id; if (Request::input('province') != 69) { $user->district = 0; } else { $user->district = Request::input('district'); } if ($user->save()) { $userinfo = Request::only('email', 'password'); //ตรวจสอบสถาบันว่ามีไหมถ้าไม่มีให้เพิ่มไป $countinstitute = institute::where('name', 'LIKE', Request::input('institute'))->count(); if ($countinstitute < 1) { $institute = new institute(); $institute->name = Request::input('institute'); $institute->save(); } //จบตรวจสอบสถาบันว่ามีไหมถ้าไม่มีให้เพิ่มไป return Redirect::to('useredit/' . Request::input('id'))->with('status', 'Update has been completed'); } else { return Redirect::to('useredit/' . Request::input('id'))->withErrors('Error some thing is wrong!'); } } else { return redirect::to('useredit/' . Request::input('id'))->withInput(Request::except('password'))->withErrors($validate->messages()); } }
public function uploadidcard() { $root_url = dirname($_SERVER['PHP_SELF']); if (Request::exists('btn-upload')) { $user_id = Request::input('user_id'); $file = Request::file('uploader'); $path = 'upload_file/idcard/default'; $filename = $file->getClientOriginalName(); //check file extension $ext = pathinfo($filename, PATHINFO_EXTENSION); $newfilename = "idcard_id" . $user_id . "." . $ext; $file->move($path, $newfilename); if ($ext == 'pdf') { //if pdf set pdf icon to thumbnail $thunbnail = 'upload_file/idcard/thumbnail/pdf.png'; } else { if ($ext == 'jpg' || $ext == 'png' || $ext == 'gif') { //if image create thumbnail $img = Image::make('upload_file/idcard/default/' . $newfilename); if ($img->height() == $img->width()) { $imgresult = $img->resize(206, 206); } else { if ($img->height() > $img->width()) { $imgresult = $img->resize(206, null, function ($constraint) { $constraint->aspectRatio(); }); } else { $imgresult = $img->resize(null, 206, function ($constraint) { $constraint->aspectRatio(); }); } } //set and save resize image to thumbnail $imgresult->save('upload_file/idcard/thumbnail/' . $newfilename); $thunbnail = 'upload_file/idcard/thumbnail/' . $newfilename; } } $count = idcard::where('id_user', '=', $user_id)->count(); if ($count == 1) { $dbidcard = idcard::where('id_user', '=', $user_id)->first(); $oldext = pathinfo($dbidcard->id_name, PATHINFO_EXTENSION); $image_path = '../' . $root_url . '/upload_file/idcard/default/' . $dbidcard->id_name; if ($oldext != 'pdf') { $image_thumbnail = '..' . $root_url . '/' . $dbidcard->id_thumbnail; if ($newfilename != $dbidcard->id_name) { unlink($image_thumbnail); } } if ($newfilename != $dbidcard->id_name) { unlink($image_path); } //update link $dbidcard->id_name = $newfilename; $dbidcard->id_thumbnail = $thunbnail; $dbidcard->save(); //update id validate status $user = Member::where('id', '=', $user_id)->first(); $validate = $user->validate; $mail_st = substr($validate, 1, 1); $verify_id = substr($validate, 3, 1); $new_validate = "1" . $mail_st . "1" . $verify_id; $user->validate = $new_validate; $user->save(); //End update id validate status } else { //save to batabase $dbidcard = new idcard(); $dbidcard->id_name = $newfilename; $dbidcard->id_user = $user_id; $dbidcard->id_thumbnail = $thunbnail; $dbidcard->save(); //update id validate status $user = Member::where('id', '=', $user_id)->first(); $validate = $user->validate; $mail_st = substr($validate, 1, 1); $verify_id = substr($validate, 3, 1); $new_validate = "1" . $mail_st . "1" . $verify_id; $user->validate = $new_validate; $user->save(); //End update id validate status } } return redirect()->back(); }
public static function checkemailverify() { $user = Member::where("id", "=", Auth::user()->id)->first(); $u_status = $user->validate; $mail_st = substr($u_status, 1, 1); if ($mail_st == 1) { return true; } else { return false; } }
public static function update_user_form($user_id, $value_name) { if ($value_name == "permission" || $value_name == "validate" || $value_name == "status_mail") { $user = Member::where("id", "=", $user_id)->first(); if ($value_name == "status_mail") { $return_value = $user->validate; } else { $return_value = $user->{$value_name}; } if ($value_name == "permission") { $data_permissions = ["1" => "User - ผู้ใช้ทั่วไป", "2" => "Staff - พนักงาน", "3" => "Admin - ผู้ดูแลระบบ"]; $return_data = "<select name='permission' id='permission' class='form-control'>"; foreach ($data_permissions as $permission => $permission_value) { $return_data .= "<option value='" . $permission . "'"; if ($return_value == $permission) { $return_data .= " selected='selected'"; } $return_data .= ">" . $permission_value . "</option>"; } $return_data .= "</select>"; } else { if ($value_name == "validate") { $oldvalidate = $return_value; $validate_id_status = substr($oldvalidate, 3, 1); if ($validate_id_status == 1) { $return_data = "checked"; } else { $return_data = ""; } } else { if ($value_name == "status_mail") { $oldvalidate = $return_value; $validate_id_status = substr($oldvalidate, 1, 1); if ($validate_id_status == 1) { $return_data = "checked"; } else { $return_data = ""; } } } } } else { if ($value_name == "grade" || $value_name == "training_status" || $value_name == "training_date" || $value_name == "remark") { $count_userdetail = Userdetail::where("id", "=", $user_id)->count(); //=================================================================================== if ($value_name == "grade") { $data_grade = ["0" => "none", "4" => "A", "3" => "B", "2" => "C", "1" => "D"]; $return_data = "<select name='grade' id='grade' class='form-control'>"; foreach ($data_grade as $grade => $grade_value) { $return_data .= "<option value='" . $grade . "'"; if ($count_userdetail > 0) { $userdetail = Userdetail::where("id", "=", $user_id)->first(); if ($userdetail->grade == $grade) { $return_data .= " selected='selected'"; } } $return_data .= ">" . $grade_value . "</option>"; } $return_data .= "</select>"; } else { if ($count_userdetail > 0) { $userdetail = Userdetail::where("id", "=", $user_id)->first(); $userdetail_value = $userdetail->{$value_name}; if ($value_name == "training_status") { if ($userdetail_value == 1) { $return_data = "checked"; } else { $return_data = ""; } } else { if ($value_name == "training_date" && !empty($userdetail_value)) { $split_training_date = explode("-", $userdetail_value); $return_data = $split_training_date[2] . "/" . $split_training_date[1] . "/" . $split_training_date[0]; } else { $return_data = $userdetail_value; } } } else { $return_data = ""; } } } } //=================================================================================== echo $return_data; }
public static function save_database($user_id, $save_name, $role_method) { if ($role_method == "profile") { $count = imageDB::where('image_user', '=', $user_id)->count(); if ($count == 1) { $database = imageDB::where('image_user', '=', $user_id)->first(); } else { $database = new imageDB(); } $database->image_name = $save_name; $database->image_thumbnail = "upload_file/images/thumbnail/" . $save_name; $database->image_user = $user_id; } else { $count = idcardDB::where('id_user', '=', $user_id)->count(); if ($count == 1) { $database = idcardDB::where('id_user', '=', $user_id)->first(); } else { $database = new idcardDB(); } $database->id_name = $save_name; $database->id_thumbnail = "upload_file/idcard/thumbnail/" . $save_name; $database->id_user = $user_id; //update id validate status $user = Member::where('id', '=', $user_id)->first(); $validate = $user->validate; $mail_st = substr($validate, 1, 1); $verify_id = substr($validate, 3, 1); $new_validate = "1" . $mail_st . "1" . $verify_id; $user->validate = $new_validate; $user->save(); //End update id validate status } $database->save(); }