Skip to content

Commit

Permalink
Adding documentation comments
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorcsimma committed Oct 28, 2023
1 parent 983f71d commit 3d309bd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/Models/ApplicationForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,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 @@ -50,32 +50,47 @@ 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) {
return $user->isExtern();
});
}

/**
* Returns the color of the workshop's badge to be displayed.
*/
public function color()
{
switch ($this->name) {
Expand Down
6 changes: 6 additions & 0 deletions app/Models/WorkshopBalance.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ class WorkshopBalance extends Model
'used_balance',
];

/**
* Returns the workshop the balance belongs to.
*/
public function workshop()
{
return $this->belongsTo('App\Models\Workshop');
}

/**
* Returns the semester the balance belongs to.
*/
public function semester()
{
return $this->belongsTo('App\Models\Semester');
Expand Down

0 comments on commit 3d309bd

Please sign in to comment.