Added member and invitation endpoints

This commit is contained in:
Constantin Graf
2024-04-10 17:45:53 +02:00
parent 234fa06324
commit b67961cb07
48 changed files with 1186 additions and 106 deletions

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Models;
use Database\Factories\ProjectMemberFactory;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
@@ -18,6 +19,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @property-read Project $project
* @property-read User $user
*
* @method static Builder<ProjectMember> whereBelongsToOrganization(Organization $organization)
* @method static ProjectMemberFactory factory()
*/
class ProjectMember extends Model
@@ -49,4 +51,14 @@ class ProjectMember extends Model
{
return $this->belongsTo(User::class, 'user_id');
}
/**
* @param Builder<ProjectMember> $builder
*/
public function scopeWhereBelongsToOrganization(Builder $builder, Organization $organization): void
{
$builder->whereHas('project', static function (Builder $query) use ($organization): void {
$query->whereBelongsTo($organization, 'organization');
});
}
}