Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 1 |
ClonedSharedShortcut | |
0.00% |
0 / 6 |
|
0.00% |
0 / 6 |
42 | |
0.00% |
0 / 1 |
setSharedWithOthersAttribute | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getSharedWithOthersAttribute | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
flyshare | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
user | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
shareHistoryShortcuts | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
shortcut | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace App\Http\Models; |
4 | |
5 | use App\Http\Models\Auth\User; |
6 | use App\Http\Scopes\UserScope; |
7 | |
8 | class ClonedSharedShortcut extends Moloquent |
9 | { |
10 | /** |
11 | * The attributes that are mass assignable. |
12 | * |
13 | * @var array |
14 | */ |
15 | // protected $fillable = [ |
16 | // 'user_id', 'flyshare_id', 'reference_shortcut_id' |
17 | // ]; |
18 | |
19 | /** |
20 | * The accessors to append to the model's array form. |
21 | * |
22 | * @var array |
23 | */ |
24 | protected $appends = ['shared_with_others']; |
25 | |
26 | /** |
27 | * Set the shared_with_others attribute. |
28 | */ |
29 | public function setSharedWithOthersAttribute(string $value): void |
30 | { |
31 | $this->attributes['shared_with_others'] = true; |
32 | } |
33 | |
34 | /** |
35 | * Get the shared_with_others atrribute for the shortcut. |
36 | */ |
37 | public function getSharedWithOthersAttribute(): bool |
38 | { |
39 | return true; |
40 | } |
41 | |
42 | /** |
43 | * The table associated with the model. |
44 | * |
45 | * @var string |
46 | */ |
47 | protected $table = 'cloned_shared_shortcuts'; |
48 | |
49 | /** |
50 | * Get the flyshare that belongs to the cloned shortcut. |
51 | */ |
52 | public function flyshare() |
53 | { |
54 | return $this->belongsTo(FlyShare::class); |
55 | } |
56 | |
57 | /** |
58 | * Get the user that owns the cloned shortcut |
59 | * |
60 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
61 | */ |
62 | public function user() |
63 | { |
64 | return $this->belongsTo(User::class); |
65 | } |
66 | |
67 | /** |
68 | * Get the shares shortcut (shortcut that has been received) that the cloned shortcut has been duplicated into. |
69 | */ |
70 | public function shareHistoryShortcuts() |
71 | { |
72 | return $this->hasMany(SharesShortcut::class, 'reference_cloned_shortcut_id'); |
73 | } |
74 | |
75 | /** |
76 | * Get the shortcut from which this cloned was created |
77 | * |
78 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
79 | */ |
80 | public function shortcut() |
81 | { |
82 | return $this->belongsTo(Shortcut::class, 'reference_shortcut_id')->withoutGlobalScope(UserScope::class); |
83 | } |
84 | } |