36 lines
831 B
PHP
36 lines
831 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\OrganisationRole;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class OrganisationInvitation extends Model
|
|
{
|
|
/** @use HasFactory<\Database\Factories\OrganisationInvitationFactory> */
|
|
use HasFactory;
|
|
|
|
protected $guarded = [];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'role' => OrganisationRole::class,
|
|
'accepted_at' => 'datetime',
|
|
'expires_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function organisation(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Organisation::class);
|
|
}
|
|
|
|
public function invitedBy(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'invited_by_user_id');
|
|
}
|
|
}
|