first commit
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled

This commit is contained in:
brusnitsyn
2026-04-06 00:06:00 +09:00
commit fb2e6c58e3
409 changed files with 42953 additions and 0 deletions

59
app/Models/Membership.php Normal file
View File

@@ -0,0 +1,59 @@
<?php
namespace App\Models;
use App\Enums\TeamRole;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\Pivot;
#[Fillable(['team_id', 'user_id', 'role'])]
class Membership extends Pivot
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'team_members';
/**
* Indicates if the IDs are auto-incrementing.
*
* @var bool
*/
public $incrementing = true;
/**
* Get the team that the membership belongs to.
*
* @return BelongsTo<Team, $this>
*/
public function team(): BelongsTo
{
return $this->belongsTo(Team::class);
}
/**
* Get the user that belongs to this membership.
*
* @return BelongsTo<Model, $this>
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'role' => TeamRole::class,
];
}
}