/** * Run the database seeds. * * @return void */ public function run() { $faker = \Faker\Factory::create(); User::truncate(); // DB::table('users')->insert([ User::insert([['name' => 'Kenn E. Thompson', 'email' => '*****@*****.**', 'password' => bcrypt('abc123'), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]]); foreach (range(1, 99) as $index) { User::insert(['name' => $faker->name, 'email' => $faker->email, 'password' => bcrypt('secret'), 'created_at' => dateTime($max = 'now'), 'updated_at' => dateTime($max = 'now')]); } }
public function addResume() { $data['student_id'] = session('account.student_id'); $data['create_time'] = dateTime(); $data['modify_time'] = $data['create_time']; $data['resume_type'] = $this->resumeZh; $data['valid_status'] = $this->resumeShow; $data['default_status'] = 1; $last_id = $this->data($data)->add(); return $last_id; }
<?php /* |-------------------------------------------------------------------------- | Model Factories |-------------------------------------------------------------------------- | | Here you may define all of your model factories. Model factories give | you a convenient way to create models for testing and seeding your | database. Just tell the factory how a default model should look. | */ $factory->define(App\User::class, function (Faker\Generator $faker) { return ['name' => $faker->name, 'email' => $faker->email, 'password' => bcrypt(str_random(10)), 'remember_token' => str_random(10)]; }); $factory->define(App\Lesson::class, function (Faker\Generator $faker) { return ['title' => $faker->sentence, 'body' => $faker->text, 'updated_at' => dateTime()]; });
public function account() { $this->chkStudentCenter(); $data = $this->StudentModel->getStudentinfo(session('account.student_id')); $data['href'] = $this->mailLoginHref($data['login_email']); $this->assign('user', $data); $trace_result = $this->TraceSetupController->returnTraceId(session('account.student_id')); /*2015-12-01 默认值*/ $traceSetupModel = D('TraceSetup'); $now_time = date('Y-m-d', time()) . ' 07:00:00'; if (empty($trace_result[3])) { $traceSetupModel->add(array('trace_id' => 3, 'account_id' => session('account.student_id'), 'crontab_time' => $now_time, 'hours' => 72, 'number' => 25, 'create_time' => dateTime())); } $trace_result = $this->TraceSetupController->returnTraceId(session('account.student_id')); $trace_type = array('invitation_wait' => !empty($trace_result[3]) ? 'edit' : 'add'); // 手机验证开始 2015-11-14 09:52:20 星期六 $mobile = $this->StudentModel->getMobile(); $mobile['verify'] = $mobile['status'] && $mobile['mobile_verify'] == 1 ? TRUE : FALSE; //手机已经验证 $this->assign('mobile', $mobile); $this->assign('trace_result', $trace_result); $this->assign('trace_type', $trace_type); $this->assign('trace_number', trace_number()); if (isMobile()) { $this->display('/MobileStudent/account'); exit; } $this->display('account_setting'); }
public function tagAdd() { $title = I('post.title'); $where = array('title' => $title, 'account_id' => session('account.account_id'), 'is_delete' => 2, 'type' => 2); //判断是否存在该标签 $result = $this->TagModel->returnDataByFields($where); if (!empty($result)) { returnJson(array('status' => 'success', 'pkid' => $result)); } $data = $where; $data['range'] = 1; $data['create_time'] = dateTime(); $id = $this->TagModel->tagAdd($data); //新增标签 if ($id !== FALSE) { returnJson(array('status' => 'success', 'pkid' => $id)); } else { returnJson(array('status' => 'fail')); } }
public function deleteCertificateModule($id) { $data['modify_time'] = dateTime(); $data['is_delete'] = $this->deleteType; $where = array('student_id' => D('Account')->studentID(), 'language_type' => 1); return $this->where($where)->data($data)->save(); }
/** * Calculate the time since ago * @param int * @param int * @return string */ function timeSince($iTime0, $iTime1 = 0) { // If not time specified then return null if (!$iTime0) { return null; } if ($iTime1 == 0) { $iTime1 = time(); } $iTimeElapsed = $iTime1 - $iTime0; if ($iTimeElapsed < 60) { return "Less than a minute ago"; } else { if ($iTimeElapsed < 60 * 60) { $iNum = intval($iTimeElapsed / 60); $sUnit = "minute"; } else { if ($iTimeElapsed < 10 * 60 * 60) { $iNum = intval($iTimeElapsed / (60 * 60)); $sUnit = "hour"; } else { return dateTime($iTime0); } } } return $iNum . " " . $sUnit . ($iNum != 1 ? "s" : "") . " ago"; }
protected function upload($uploadDir, $key, $fileType, $fileInput, $isDownload = 0) { $attr = array(); $return = array(); $attr['addtime'] = dateTime(); $attr['fileKey'] = uniqid(); $attr['filePath'] = ''; $id = M('Files')->add($attr); $pic_path = $uploadDir . '/' . date('Y') . '/' . date('m') . '/' . date('d'); createDirs($pic_path); $uploadfile_path = $pic_path . '/' . $id . '_' . date("YmdHis") . '_' . uniqid() . '.' . $fileType; $isUploaded = 0; if ($isDownload) { if (file_put_contents($uploadfile_path, $fileInput)) { $isUploaded = 1; } } else { $return['size'] = $_FILES[$fileInput]['size'][$key]; if (move_uploaded_file($_FILES[$fileInput]['tmp_name'][$key], $uploadfile_path)) { $isUploaded = 1; } } if ($isUploaded) { @chmod($uploadfile_path, 0777); $return['code'] = 1; $return['path'] = str_replace($this->fileRootDir, "", $uploadfile_path); $return['fileKey'] = $attr['fileKey']; M("Files")->where("id='%d'", array($id))->save(array('filePath' => $return['path'])); } else { $return['code'] = 0; $return['msg'] = "對不起,文件上傳失敗!"; M("Files")->where("id='%d'", array($id))->save(array('status' => 0)); } return $return; }
function upInvite($code = "", $model = '') { if (!$model) { $model = M('invite_code'); } if ($code) { $data['status'] = 2; $data['use_time'] = dateTime(); $bool = $model->data($data)->where(array('code' => $code))->save(); return $bool; } }
public function updateSubStatus($type = "") { if ($type) { if ($type == 1) { //打开 $data['status'] = 1; } if ($type == 2) { //关闭 $data['status'] = 2; } $data['modify_time'] = dateTime(); return $this->data($data)->where(array('student_id' => session('account.student_id'), 'info_type' => 2))->save(); } }
public function readResume($pkid) { $data['modify_time'] = dateTime(); $data['read_time'] = dateTime(); $data['status'] = 2; $where['enterprise_id'] = session('account.enterprise_id'); $where['pkid'] = $pkid; $where['status'] = array('ELT', 1); $this->where($where)->data($data)->save(); }
public function studentSaveInfo($data, $account_id) { $data['modify_time'] = dateTime(); return $this->data($data)->where(array('account_id' => $account_id))->save(); }
<form method="POST"> <input type="text" placeholder="string" name="string" /> <input type="submit"/> </form> <?php if (isset($_POST['string'])) { $string = isset($_POST['string']) ? $_POST['string'] : ''; echo $string . "<br>"; } require_once 'mylib.php'; echo dateTime(); echo $_SERVER['QUERY_STRING'];
public function resumeExist($data) { $resume_type = 4; $type = 'add'; $result = $this->ResumeModel->resumeInfo($resume_type); if (!empty($result)) { unlink($result['file_path']); $type = 'edit'; } $data['resume_type'] = $resume_type; $data['student_id'] = session('account.student_id'); $data['default_status'] = !empty($result['default_status']) ? $result['default_status'] : 2; //非默认投递状态 $data['valid_status'] = 1; //默认显示状态 $data['create_time'] = dateTime(); $this->ResumeModel->resumeSave($data, $type, $resume_type); }
public function updateContact($data) { $contactModel = M('enterprise_contact'); $where['type'] = 1; $where['enterprise_id'] = session('account.enterprise_id'); $contact_id = $contactModel->where($where)->order('pkid desc')->getField('pkid'); if ($contact_id > 0) { $where['pkid'] = $contact_id; $contactModel->data($data)->where($where)->save(); } else { $data['type'] = 1; $data['create_time'] = dateTime(); $data['modify_time'] = dateTime(); $data['enterprise_id'] = session('account.enterprise_id'); $contactModel->data($data)->add(); } }
public function updateReflushTime($pid) { $data['refresh_time'] = dateTime(); $date['modify_time'] = $data['refresh_time']; $where['pkid'] = $pid; $where['enterprise_id'] = session('account.enterprise_id'); return $this->data($data)->where($where)->save(); }