-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added group type model, request and request builder
- Loading branch information
Showing
3 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
<?php | ||
|
||
namespace CTApi\Models\Groups\Group; | ||
|
||
use CTApi\Models\AbstractModel; | ||
use CTApi\Models\Common\Domain\Meta; | ||
use CTApi\Models\Common\File\FileRequest; | ||
use CTApi\Models\Common\File\FileRequestBuilder; | ||
use CTApi\Models\Groups\GroupMeeting\GroupMeetingRequestBuilder; | ||
use CTApi\Models\Groups\GroupMember\GroupMemberRequestBuilder; | ||
use CTApi\Models\Groups\Person\Person; | ||
use CTApi\Traits\Model\FillWithData; | ||
use CTApi\Traits\Model\MetaAttribute; | ||
|
||
class GroupType extends AbstractModel | ||
{ | ||
use FillWithData, MetaAttribute; | ||
|
||
|
||
protected ?bool $availableForNewPerson = null; | ||
protected ?bool $isLeaderNecessary = null; | ||
protected ?string $name = null; | ||
protected ?string $namePlural = null; | ||
protected ?string $namePluralTranslated = null; | ||
protected ?string $nameTranslated = null; | ||
protected ?int $permissionDepth = null; | ||
protected ?string $shorty = null; | ||
protected ?int $sortKey = null; | ||
|
||
/** | ||
* @param string|null $id | ||
* @return Group | ||
*/ | ||
public function setId(?string $id): Group | ||
{ | ||
$this->id = $id; | ||
return $this; | ||
} | ||
|
||
public function getAvailableForNewPerson(): ?bool | ||
{ | ||
return $this->availableForNewPerson; | ||
} | ||
|
||
public function setAvailableForNewPerson(?bool $availableForNewPerson): static | ||
{ | ||
$this->availableForNewPerson = $availableForNewPerson; | ||
return $this; | ||
} | ||
|
||
public function getIsLeaderNecessary(): ?bool | ||
{ | ||
return $this->isLeaderNecessary; | ||
} | ||
|
||
public function setIsLeaderNecessary(?bool $isLeaderNecessary): static | ||
{ | ||
$this->isLeaderNecessary = $isLeaderNecessary; | ||
return $this; | ||
} | ||
|
||
public function getName(): ?string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
public function setName(?string $name): static | ||
{ | ||
$this->name = $name; | ||
return $this; | ||
} | ||
|
||
public function getNamePlural(): ?string | ||
{ | ||
return $this->namePlural; | ||
} | ||
|
||
public function setNamePlural(?string $namePlural): static | ||
{ | ||
$this->namePlural = $namePlural; | ||
return $this; | ||
} | ||
|
||
public function getNamePluralTranslated(): ?string | ||
{ | ||
return $this->namePluralTranslated; | ||
} | ||
|
||
public function setNamePluralTranslated(?string $namePluralTranslated): static | ||
{ | ||
$this->namePluralTranslated = $namePluralTranslated; | ||
return $this; | ||
} | ||
|
||
public function getNameTranslated(): ?string | ||
{ | ||
return $this->nameTranslated; | ||
} | ||
|
||
public function setNameTranslated(?string $nameTranslated): static | ||
{ | ||
$this->nameTranslated = $nameTranslated; | ||
return $this; | ||
} | ||
|
||
public function getPermissionDepth(): ?int | ||
{ | ||
return $this->permissionDepth; | ||
} | ||
|
||
public function setPermissionDepth(?int $permissionDepth): static | ||
{ | ||
$this->permissionDepth = $permissionDepth; | ||
return $this; | ||
} | ||
|
||
public function getShorty(): ?string | ||
{ | ||
return $this->shorty; | ||
} | ||
|
||
public function setShorty(?string $shorty): static | ||
{ | ||
$this->shorty = $shorty; | ||
return $this; | ||
} | ||
|
||
public function getSortKey(): ?int | ||
{ | ||
return $this->sortKey; | ||
} | ||
|
||
public function setSortKey(?int $sortKey): static | ||
{ | ||
$this->sortKey = $sortKey; | ||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace CTApi\Models\Groups\Group; | ||
|
||
|
||
class GroupTypeRequest | ||
{ | ||
public static function all(): array | ||
{ | ||
return (new GroupTypeRequestBuilder())->all(); | ||
} | ||
|
||
public static function where(string $key, $value): GroupTypeRequestBuilder | ||
{ | ||
return (new GroupTypeRequestBuilder())->where($key, $value); | ||
} | ||
|
||
public static function orderBy(string $key, $orderAscending = true): GroupTypeRequestBuilder | ||
{ | ||
return (new GroupTypeRequestBuilder())->orderBy($key, $orderAscending); | ||
} | ||
|
||
public static function findOrFail(int $id): GroupType | ||
{ | ||
return (new GroupTypeRequestBuilder())->findOrFail($id); | ||
} | ||
|
||
public static function find(int $id): ?GroupType | ||
{ | ||
return (new GroupTypeRequestBuilder())->find($id); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace CTApi\Models\Groups\Group; | ||
|
||
use CTApi\Models\AbstractRequestBuilder; | ||
|
||
class GroupTypeRequestBuilder extends AbstractRequestBuilder | ||
{ | ||
protected function getApiEndpoint(): string | ||
{ | ||
return '/api/group/grouptypes'; | ||
} | ||
|
||
protected function getModelClass(): string | ||
{ | ||
return GroupType::class; | ||
} | ||
} |