Files
monica/app/Models/Account/AccountLink.php
T
2025-11-06 19:44:31 +02:00

57 lines
1.1 KiB
PHP

<?php
namespace App\Models\Account;
use App\Models\User\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @property Account $account
* @property User $invitedBy
* @property User $user
* @property string $invitation_key
*/
class AccountLink extends Model
{
use Notifiable;
/**
* The attributes that aren't mass assignable.
*
* @var array<string>|bool
*/
protected $guarded = ['id'];
/**
* Get the account record that is being shared.
*
* @return BelongsTo
*/
public function account()
{
return $this->belongsTo(Account::class);
}
/**
* Get the user who sent the invitation.
*
* @return BelongsTo
*/
public function invitedBy()
{
return $this->belongsTo(User::class, 'invited_by_user_id');
}
/**
* Get the existing user being invited to link accounts.
*
* @return BelongsTo
*/
public function user()
{
return $this->belongsTo(User::class, 'user_id');
}
}