0 ]; } public static function getAllDepartmentNames() { $departmentsList = RedBean::findAll(Department::TABLE); $departmentsNameList = []; foreach($departmentsList as $department) { $departmentsNameList[] = [ 'id' => $department->id, 'name' => $department->name, 'owners' => $department->owners, 'private' => $department->private ]; } return $departmentsNameList; } public static function getPublicDepartmentNames() { $departmentsList = RedBean::findAll(Department::TABLE); $departmentsNameList = []; foreach($departmentsList as $department) { if(!$department->private) { $departmentsNameList[] = [ 'id' => $department->id, 'name' => $department->name, 'owners' => $department->owners, 'private' => $department->private ]; } } return $departmentsNameList; } public function toArray() { return [ 'id' => $this->id, 'name' => $this->name, 'owners' => $this->owners ]; } }