forked from anonaddy/anonaddy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AliasRecipient.php
53 lines (41 loc) · 1.05 KB
/
AliasRecipient.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace App;
use App\Traits\HasUuid;
use Illuminate\Database\Eloquent\Relations\Pivot;
class AliasRecipient extends Pivot
{
use HasUuid;
public $incrementing = false;
protected $keyType = 'string';
public $timestamps = false;
protected $table = 'alias_recipients';
protected $casts = [
'id' => 'string',
'alias_id' => 'string',
'recipient_id' => 'string'
];
public function setAliasAttribute($alias)
{
$this->attributes['alias_id'] = $alias->getKey();
$this->setRelation('alias', $alias);
}
public function setRecipientAttribute($recipient)
{
$this->attributes['recipient_id'] = $recipient->getKey();
$this->setRelation('recipient', $recipient);
}
/**
* Get the alias for this pivot row.
*/
public function alias()
{
return $this->belongsTo(Alias::class);
}
/**
* Get the recipient for this pivot row.
*/
public function recipient()
{
return $this->belongsTo(Recipient::class);
}
}