本文整理汇总了PHP中Roles::find_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Roles::find_by_id方法的具体用法?PHP Roles::find_by_id怎么用?PHP Roles::find_by_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Roles
的用法示例。
在下文中一共展示了Roles::find_by_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findRole
public function findRole($id)
{
$empRole = Roles::find_by_id($id);
if ($empRole) {
return $empRole;
//print_r($empRole);
} else {
return false;
}
}
示例2: delete
public function delete($id)
{
$article = Roles::find_by_id($id);
if ($article->delete()) {
return true;
}
}
示例3: UpdateEmpRole
/**
* this section is required
* to update employee role
*/
public function UpdateEmpRole()
{
$rEmployee = Employee::find_by_id($_POST['empid']);
$rEmployee->emp_post = $_POST['emppost'];
$rEmployee->emp_dept = $_POST['empdept'];
$empDept = Department::find_by_id($_POST['empdept']);
$Tlog = new Transaction();
$Tlog->com_id = $empDept->dept_code;
$Tlog->trans_type = "HR DEPARTMENT";
$Tlog->trans_description = "Employee assigned to " . $empDept->dept_name . " Department";
$Tlog->datecreated = date("Y-m-d H:i:s");
$Tlog->user_id = $_SESSION['emp_ident'];
$empRole = Roles::find_by_id($_POST['emppost']);
$Tlog2 = new Transaction();
$Tlog2->com_id = $empRole->main_id;
$Tlog2->trans_type = "HR DEPARTMENT";
$Tlog2->trans_description = "Employee assigned " . $empRole->role_name . " Role";
$Tlog2->datecreated = date("Y-m-d H:i:s");
$Tlog2->user_id = $_SESSION['emp_ident'];
if ($rEmployee->update()) {
$Tlog2->create();
$Tlog->create();
return true;
} else {
return false;
}
}