本文整理汇总了PHP中permissions::where方法的典型用法代码示例。如果您正苦于以下问题:PHP permissions::where方法的具体用法?PHP permissions::where怎么用?PHP permissions::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类permissions
的用法示例。
在下文中一共展示了permissions::where方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listAll
public function listAll()
{
$toReturn['exams'] = examsList::where('examAcYear', $this->panelInit->selectAcYear)->get()->toArray();
if ($this->data['users']->role == "teacher") {
$toReturn['classes'] = classes::where('classAcademicYear', $this->panelInit->selectAcYear)->where('classTeacher', 'LIKE', '%"' . $this->data['users']->id . '"%')->get()->toArray();
} else {
$toReturn['classes'] = classes::where('classAcademicYear', $this->panelInit->selectAcYear)->get()->toArray();
}
$toReturn['userRole'] = $this->data['users']->role;
$newrole = $this->data['users']->newrole;
$newrole_array = json_decode($newrole);
$params = permissions::where('moduleId', 1)->where('permission', 1)->get();
$uniparam = array(5, 6, 7, 8, 15);
if ($toReturn['userRole'] == "teacher") {
if (array_intersect($newrole_array, $uniparam)) {
$toReturn['access'] = 1;
} else {
$toReturn['access'] = 0;
}
} elseif ($toReturn['userRole'] == "admin") {
$toReturn['access'] = 1;
} else {
$toReturn['access'] = 0;
}
$toReturn['newuserRole'] = $this->data['users']->newrole;
return $toReturn;
}
示例2: listAll
public function listAll()
{
$toReturn = array();
$toReturn['grades'] = gradeLevels::get()->toArray();
$toReturn['userRole'] = $this->data['users']->role;
$toReturn['newuserRole'] = $this->data['users']->newrole;
$toReturn['userRole'] = $this->data['users']->role;
$newrole = $this->data['users']->newrole;
$newrole_array = json_decode($newrole);
$params = permissions::where('moduleId', 3)->where('permission', 1)->get();
foreach ($params as $param) {
$uniparam[] = $param->roleId;
}
if ($toReturn['userRole'] == "teacher") {
if (array_intersect($newrole_array, $uniparam)) {
$toReturn['access'] = 1;
} else {
$toReturn['access'] = 0;
}
} elseif ($toReturn['userRole'] == "admin") {
$toReturn['access'] = 1;
} else {
$toReturn['access'] = 0;
}
return $toReturn;
}
示例3: update
public function update()
{
$moduleId = Input::get('moduleId');
$roleId = Input::get('roleId');
$permissionValue = Input::get('permission');
$matchThese = ['moduleId' => $moduleId, 'roleId' => $roleId];
$permissions = permissions::where('roleId', '=', $roleId)->first();
$query = 'update permissions set permission= ' . $permissionValue . ' where moduleId =' . $moduleId . ' and roleId=' . $roleId;
$result = DB::update($query);
return 1;
}
示例4: __construct
public function __construct()
{
$this->panelInit = new \DashboardInit();
$this->data['panelInit'] = $this->panelInit;
$this->data['breadcrumb']['User Settings'] = \URL::to('/dashboard/user');
$this->data['users'] = \Auth::user();
$params = permissions::where('moduleId', 2)->where('permission', 1)->get();
foreach ($params as $param) {
$uniparam[] = $param->roleId;
}
$params = permissions::where('moduleId', 4)->where('permission', 1)->get();
foreach ($params as $param) {
$uniparam2[] = $param->roleId;
}
$this->data['attendancepermission'] = $uniparam;
$this->data['staffattendancepermission'] = $uniparam2;
}
示例5: listAll
public function listAll()
{
$toReturn = array();
$toReturn['classes'] = classes::where('classAcademicYear', $this->panelInit->selectAcYear)->get()->toArray();
$classesArray = array();
while (list(, $class) = each($toReturn['classes'])) {
$classesArray[$class['id']] = $class['className'];
}
$toReturn['assignments'] = array();
if (count($classesArray) > 0) {
$assignments = new assignments();
if ($this->data['users']->role == "student") {
$assignments = $assignments->where('classId', 'LIKE', '%"' . $this->data['users']->studentClass . '"%');
} else {
while (list($key, ) = each($classesArray)) {
$assignments = $assignments->orWhere('classId', 'LIKE', '%"' . $key . '"%');
}
}
if ($this->data['users']->role == "teacher") {
$assignments = $assignments->where('teacherId', $this->data['users']->id);
}
$assignments = $assignments->get();
foreach ($assignments as $key => $assignment) {
$classId = json_decode($assignment->classId);
if ($this->data['users']->role == "student" and !in_array($this->data['users']->studentClass, $classId)) {
continue;
}
$toReturn['assignments'][$key]['id'] = $assignment->id;
$toReturn['assignments'][$key]['subjectId'] = $assignment->subjectId;
$toReturn['assignments'][$key]['AssignTitle'] = $assignment->AssignTitle;
$toReturn['assignments'][$key]['AssignDescription'] = $assignment->AssignDescription;
$toReturn['assignments'][$key]['AssignFile'] = $assignment->AssignFile;
$toReturn['assignments'][$key]['AssignDeadLine'] = $assignment->AssignDeadLine;
$toReturn['assignments'][$key]['classes'] = "";
while (list(, $value) = each($classId)) {
if (isset($classesArray[$value])) {
$toReturn['assignments'][$key]['classes'] .= $classesArray[$value] . ", ";
}
}
}
}
$toReturn['userRole'] = $this->data['users']->role;
$newrole = $this->data['users']->newrole;
$newrole_array = json_decode($newrole);
$params = permissions::where('moduleId', 1)->where('permission', 1)->get();
foreach ($params as $param) {
$uniparam[] = $param->roleId;
}
if ($toReturn['userRole'] == "teacher") {
if (array_intersect($newrole_array, $uniparam)) {
$toReturn['access'] = 1;
} else {
$toReturn['access'] = 0;
}
} elseif ($toReturn['userRole'] == "admin") {
$toReturn['access'] = 1;
} else {
$toReturn['access'] = 0;
}
$toReturn['newuserRole'] = $this->data['users']->newrole;
return $toReturn;
}