本文整理汇总了PHP中Department::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Department::create方法的具体用法?PHP Department::create怎么用?PHP Department::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Department
的用法示例。
在下文中一共展示了Department::create方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Department::create([]);
}
}
示例2: run
public function run()
{
//$faker = Faker::create();
//foreach(range(1, 10) as $index)
//{
Department::create(['name' => '采购', 'short_name' => 'CG', 'right' => '', 'parent_id' => 0, 'sort' => 0]);
Department::create(['name' => '销售', 'short_name' => 'XS', 'right' => '', 'parent_id' => 0, 'sort' => 0]);
Department::create(['name' => '仓库', 'short_name' => 'CK', 'right' => '', 'parent_id' => 0, 'sort' => 0]);
Department::create(['name' => '财务', 'short_name' => 'CW', 'right' => '', 'parent_id' => 0, 'sort' => 0]);
//}
}
示例3: run
public function run()
{
$faker = Faker\Factory::create();
DB::table('tickets')->truncate();
DB::table('departments')->truncate();
Department::create(array('name' => 'Support'));
Department::create(array('name' => 'Sales'));
for ($i = 0; $i < 60; $i++) {
Ticket::create(array('user_id' => $faker->randomNumber(1, 20), 'department_id' => $faker->randomNumber(1, 2), 'title' => $faker->sentence, 'message' => $faker->paragraph, 'status' => $faker->randomElement(array('Open', 'Closed'))));
}
}
示例4: store
/**
* Store a newly created department in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), Department::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$data['short_name'] = '';
$data['parent_id'] = 0;
$data['sort'] = 0;
Department::create($data);
return Redirect::route('admin.departments.index');
}
示例5: store
/**
* Store a newly created department in storage.
*/
public function store()
{
$validator = Validator::make($input = Input::all(), Department::rules());
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$dept = Department::create(['deptName' => $input['deptName']]);
foreach ($input['designation'] as $index => $value) {
if ($value == '') {
continue;
}
Designation::firstOrCreate(['deptID' => $dept->id, 'designation' => $value]);
}
return Redirect::route('admin.departments.index')->with('success', "<strong>{$input['deptName']}</strong> Agregado correctamente....");
}
示例6: storeAction
/**
* Create a new department
*/
public function storeAction()
{
$validation = Validator::make(Input::all(), Department::$rules);
if (!$validation->passes()) {
return Redirect::route('departments.create')->withInput()->withErrors($validation)->with('message', 'There were validation errors.');
}
/**
* Check name duplicates
*/
if (count(Department::where('name', Input::get('name'))->get())) {
return Redirect::route('departments.create')->withInput()->with('message', 'This department already exists.');
}
$department = Department::create(Input::all());
return Redirect::route('departments.show', $department->id);
}
示例7: doInsert
function doInsert()
{
if (isset($_POST['save'])) {
$NAME = $_POST['deptname'];
$SHORTNAME = $_POST['shortname'];
$ADDRESS = $_POST['address'];
$EMAIL = $_POST['email'];
$TELEPHONE = $_POST['telephone'];
$WEBSITE = $_POST['website'];
$SCHOOL = $_POST['school'];
$department = new Department();
$department->name = $NAME;
$department->shortname = $SHORTNAME;
$department->address = $ADDRESS;
$department->email = $EMAIL;
$department->telephone = $TELEPHONE;
$department->website = $WEBSITE;
$department->school_id = $SCHOOL;
}
if ($NAME == "") {
message('Department name is required!', "error");
redirect('index.php?view=add');
} elseif ($SHORTNAME == "") {
message('Short Name is required!', "error");
redirect('index.php?view=add');
} elseif ($ADDRESS == "") {
message('Address is required!', "error");
redirect('index.php?view=add');
} elseif ($EMAIL == "") {
message('Gender Name is required!', "error");
redirect('index.php?view=add');
} elseif ($TELEPHONE == "") {
message(' Telephone is required!', "error");
redirect('index.php?view=add');
} elseif ($WEBSITE == "") {
message('Website is required!', "error");
redirect('index.php?view=add');
} elseif ($SCHOOL == "") {
message('School Name is required!', "error");
redirect('index.php?view=add');
} else {
$department->create();
message('New department addedd successfully!', "success");
redirect('index.php?view=list');
}
}
示例8: create
public function create()
{
if (isset($_POST['deptname']) && !empty($_POST['deptname'])) {
$department = new Department();
$department->dept_name = $_POST['deptname'];
$department->dept_desc = $_POST['description'];
$department->date_created = date('Y-m-d H:i:s');
$department->dept_hod_name = $_POST['hod'];
//$department->dept_hod_id = $_POST[''];
$department->dept_code = Department::getID2("RJHD", "tbldept", $department->dept_name);
if ($department->create()) {
return 1;
} else {
return 2;
}
}
}
示例9: run
public function run()
{
DB::table('departments')->delete();
$common_test_para = '<p class="desc-para">
简介:妇科拥有先进的医疗设备和雄厚的技术力量。
设有不孕症、内窥镜、妇科内分泌、妇科肿瘤、妇科炎症等专科门诊。
常年开展各种妇科疾病的诊治及手术,妇科肿瘤及诊治手术达省内最先进水平。
</p>
<p class="desc-para">
科室现有一批从事妇科临床工作多年的专业医护人员队伍,其中副高职以上专业技术人员3人。
全体医务人员以人性化服务为宗旨开展各种微创治疗,新式阴式手术及腹部手术腹腔镜下,宫腔镜下完成各种妇科疾病的治疗。
</p>';
Department::create(array('name' => '妇科', 'photo' => '/images/hospital/detail.png', 'icon' => '/images/hospital/0001@3x.png', 'description' => $common_test_para, 'hospital_id' => 1));
Department::create(array('name' => '普通门诊', 'photo' => '/images/hospital/detail.png', 'icon' => '/images/hospital/0002@3x.png', 'description' => $common_test_para, 'hospital_id' => 1));
Department::create(array('name' => '乳腺科', 'photo' => '/images/hospital/detail.png', 'icon' => '/images/hospital/0003@3x.png', 'description' => $common_test_para, 'hospital_id' => 1));
Department::create(array('name' => '新生儿科', 'photo' => '/images/hospital/detail.png', 'icon' => '/images/hospital/0004@3x.png', 'description' => $common_test_para, 'hospital_id' => 1));
Department::create(array('name' => '儿外科', 'photo' => '/images/hospital/detail.png', 'icon' => '/images/hospital/0005@3x.png', 'description' => $common_test_para, 'hospital_id' => 1));
Department::create(array('name' => '儿内科', 'photo' => '/images/hospital/detail.png', 'icon' => '/images/hospital/0006@3x.png', 'description' => $common_test_para, 'hospital_id' => 1));
Department::create(array('name' => '分院儿内科', 'photo' => '/images/hospital/detail.png', 'icon' => '/images/hospital/0007@3x.png', 'description' => $common_test_para, 'hospital_id' => 1));
Department::create(array('name' => '麻醉手术室', 'photo' => '/images/hospital/detail.png', 'icon' => '/images/hospital/0008@3x.png', 'description' => $common_test_para, 'hospital_id' => 1));
Department::create(array('name' => '分院妇产科', 'photo' => '/images/hospital/detail.png', 'icon' => '/images/hospital/0009@3x.png', 'description' => $common_test_para, 'hospital_id' => 1));
}
示例10: createDepartment
/**
* Create New Department link on the top section of the left pane allows you to create a root-level department.
*
* @param string $departmentName
* @param string $parentUID
* @return $result will return an object
*/
public function createDepartment ($departmentName, $parentUID)
{
try {
if (trim( $departmentName ) == '') {
$result = new wsCreateDepartmentResponse( 25, G::loadTranslation( 'ID_DEPARTMENT_NAME_REQUIRED' ), '' );
return $result;
}
$department = new Department();
if (($parentUID != '') && ! ($department->existsDepartment( $parentUID ))) {
$result = new wsCreateDepartmentResponse( 26, G::loadTranslation( 'ID_PARENT_DEPARTMENT_NOT_EXIST' ), $parentUID );
return $result;
}
if ($department->checkDepartmentName( $departmentName, $parentUID )) {
$result = new wsCreateDepartmentResponse( 27, G::loadTranslation( 'ID_DEPARTMENT_EXISTS' ), '' );
return $result;
}
$row['DEP_TITLE'] = $departmentName;
$row['DEP_PARENT'] = $parentUID;
$departmentId = $department->create( $row );
$data['DEPARTMENT_NAME'] = $departmentName;
$data['PARENT_UID'] = $parentUID;
$data['DEPARTMENT_NAME'] = $departmentName;
$result = new wsCreateDepartmentResponse( 0, G::loadTranslation( 'ID_DEPARTMENT_CREATED_SUCCESSFULLY', SYS_LANG, $data ), $departmentId );
return $result;
} catch (Exception $e) {
$result = wsCreateDepartmentResponse( 100, $e->getMessage(), '' );
return $result;
}
}
示例11: run
public function run()
{
Department::create(['name' => 'Administration Services', 'head_id' => 1]);
Department::create(['name' => 'Accounting Services', 'head_id' => 2]);
Department::create(['name' => 'Budget Services', 'head_id' => 3]);
}
示例12: Department
break;
case 'checkEditDepartmentName':
$parent = $_REQUEST['parent'];
$dep_name = $_REQUEST['name'];
$dep_uid = $_REQUEST['uid'];
$oDepartment = new Department();
$checkVal = $oDepartment->checkDepartmentName($dep_name, $parent, $dep_uid);
echo !$checkVal ? 'true' : 'false';
break;
case 'saveDepartment':
$parent = $_REQUEST['parent'];
$dep_name = $_REQUEST['name'];
$newDepartment['DEP_PARENT'] = $parent;
$newDepartment['DEP_TITLE'] = $dep_name;
$oDept = new Department();
$oDept->create($newDepartment);
echo '{success: true}';
break;
case 'usersByDepartment':
G::LoadClass('configuration');
$sDepUid = $_REQUEST['DEP_UID'];
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(UsersPeer::USR_UID);
$oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_REPORTS_TO);
$oCriteria->add(UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL);
$oCriteria->add(UsersPeer::DEP_UID, $sDepUid);
$oDataset = DepartmentPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
示例13: Department
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
if (($RBAC_Response = $RBAC->userCanAccess("PM_USERS")) != 1) {
return $RBAC_Response;
}
require_once 'classes/model/Department.php';
$oDept = new Department();
$depRow = $_POST['form'];
if ($_POST['form']['DEP_UID'] === '') {
unset($depRow['DEP_UID']);
$oDept->create($depRow);
} else {
// $oDeptos->updateUsers($depRow);
$oDept->update($depRow);
$oDept->updateDepartmentManager($depRow['DEP_UID']);
}