Skip to content

Commit

Permalink
Adding documentation comments
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorcsimma committed Dec 30, 2023
1 parent 0e81013 commit f2d8631
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/Models/ApplicationForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo
return $this->belongsTo('App\Models\User')->withoutGlobalScope('verified');
}

/**
* Lists the files belonging to the application form.
*/
public function files(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany('App\Models\File');
Expand Down
15 changes: 15 additions & 0 deletions app/Models/Workshop.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,37 @@ class Workshop extends Model
self::TORTENESZ,
];

/**
* Lists all members of the workshop.
*/
public function users()
{
return $this->belongsToMany(User::class, 'workshop_users');
}

/**
* Lists the workshop's residents.
*/
public function residents()
{
return $this->users->filter(function ($user, $key) {
return $user->isResident();
});
}

/**
* Lists the workshop's resident-externs.
*/
public function residentExterns()
{
return $this->users->filter(function ($user, $key) {
return $user->isResidentExtern();
});
}

/**
* Lists the workshop's externs.
*/
public function externs()
{
return $this->users->filter(function ($user, $key) {
Expand All @@ -104,6 +116,9 @@ public function balance(int $semester = null): ?WorkshopBalance
return $this->balances()->firstWhere('semester_id', $semester ?? Semester::current()->id);
}

/**
* Returns the color of the workshop's badge to be displayed.
*/
public function color()
{
switch ($this->name) {
Expand Down
2 changes: 1 addition & 1 deletion app/Models/WorkshopBalance.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function workshop()
}

/**
* Returns the semester the balance has been calculated for.
* Returns the semester the balance belongs to.
*/
public function semester()
{
Expand Down

0 comments on commit f2d8631

Please sign in to comment.