本文整理汇总了PHP中Employee::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Employee::insert方法的具体用法?PHP Employee::insert怎么用?PHP Employee::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Employee
的用法示例。
在下文中一共展示了Employee::insert方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('employees')->delete();
$db = App::make('AccessDB');
$query = new Query('USERINFO', $db->get_dbh());
$query->order('USERID');
$result = $query->get('USERID,SSN,Name,Gender,BIRTHDAY,street,DEFAULTDEPTID');
$result_array = [];
foreach ($result as $row) {
$result_array[] = ['id' => $row['USERID'], 'ssn' => $row['SSN'], 'name' => $row['Name'], 'is_male' => $row['Gender'] == 'Male' ? 1 : 0, 'birthday' => $row['BIRTHDAY'], 'street' => $row['street'], 'department_id' => $row['DEFAULTDEPTID']];
}
$employee = array_chunk($result_array, 1000);
foreach ($employee as $value) {
Employee::insert($value);
}
$convert_file = public_path() . '\\Last Convert.txt';
$record = explode(';', file_get_contents($convert_file));
$record[7] = $result[count($result) - 1]['USERID'];
$file = fopen($convert_file, 'w');
fwrite($file, implode(';', $record));
fclose($file);
}
示例2: array
include 'templates/header.php';
include 'templates/navbar.php';
// FORM SUBMISSION
$alert = array();
if (isset($_POST['submit'])) {
$new_user = new User();
$_POST['password'] = md5($_POST['password']);
$new_user->instantiate($_POST);
if (!$new_user->insert()) {
$alert['error'] = '<b>Sorry!</b> New user could not be added because the <b>username/email</b> has already been used!';
} else {
if (strtolower($new_user->permission) == 'employee') {
$employee = new Employee();
$employee->user_id = $new_user->id;
$employee->validity = $_POST['validity'];
$employee->insert();
}
$alert['success'] = '<b>Okay!</b> The new user has been successfully added!';
}
}
?>
<?php
// SETTING PARAMETERS FOR SIDEBAR
$header = 'accounts';
$page = 'add';
include 'templates/sidebar.php';
?>
<div class="row" style="margin-right: 0">
<div class="col-md-6 col-md-offset-3 page-wrapper">
<h2>Add New Account</h2>
示例3: switch
if (isset($_GET['page'])) {
switch ($_GET['page']) {
case 'list':
$employees = $class_employee->getAll();
include 'views/list.php';
break;
case 'view':
$id = $_GET['id'];
$employee = $class_employee->getOne($id);
include 'views/view.php';
break;
case 'parse':
$files = glob('uploads/*.pdf', GLOB_NOSORT);
array_multisort(array_map('filemtime', $files), SORT_NUMERIC, SORT_DESC, $files);
$file = array_shift($files);
$names = get_names_from_pdf($file);
echo count($names);
foreach ($names as $name => $point) {
$class_employee->insert($name);
}
break;
case 'upload':
include 'up1.php';
break;
default:
include 'home.php';
}
} else {
include 'home.php';
}
include 'footer.php';
示例4: create
public function create()
{
Employee::insert();
require_once 'views/home_view.php';
}