userRole = $userRoleModel; $this->rolePermission = $rolePermissionModel; } //User role deletion using roleid and userid public function deleteUserRoleByUserId($id){ try{ $role = $this->userRole->where('user_id', '=', $id)->delete(); return true; }catch (Exception $e){ return false; } } public function deleteUserRoleByRoleId($id){ try{ $role = $this->userRole->where('role_id', '=', $id)->delete(); return true; }catch (Exception $e){ return false; } } //permission deletion using roleid and permissionid public function deleteRolePermissionByPermissionId($id){ try{ $permission = $this->rolePermission->where('permission_id', '=', $id)->delete(); return true; }catch (Exception $e){ return false; } } public function deleteRolePermissionByRoleId($id){ try{ $permission = $this->rolePermission->where('role_id', '=', $id)->delete(); return true; }catch (Exception $e){ return false; } } public function getAllUserWithRoleId($roleId){ try{ $users = $this->userRole->where('role_id','=', $roleId)->get(); return $users; }catch (\Exception $e){ return false; } } }