Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
UserPersona | |
0.00% |
0 / 4 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
prompt_tone | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
user | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
boot | |
0.00% |
0 / 2 |
|
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 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
8 | use MongoDB\Laravel\Eloquent\SoftDeletes; |
9 | |
10 | class UserPersona extends Moloquent |
11 | { |
12 | use HasFactory, SoftDeletes; |
13 | protected $table = 'user_persona'; |
14 | |
15 | protected $fillable = [ |
16 | 'user_id', |
17 | 'is_default', |
18 | 'name', |
19 | 'professional_interests', |
20 | 'first_name', |
21 | 'last_name', |
22 | 'industry', |
23 | 'prompt_tone_id', |
24 | 'type', |
25 | 'linkedin_url', |
26 | 'achievements', |
27 | 'preferred_keywords_and_phrases', |
28 | 'communication_style', |
29 | 'company_name', |
30 | 'education_background', |
31 | 'field_of_expertise', |
32 | 'goals', |
33 | 'hobbies', |
34 | 'personal_interests', |
35 | 'skills', |
36 | 'taboos', |
37 | 'title', |
38 | 'content', |
39 | 'networking', |
40 | 'personal_info', |
41 | 'ai_emulation', |
42 | 'updated_at', |
43 | 'created_at', |
44 | 'deleted_at', |
45 | 'disabled' |
46 | ]; |
47 | |
48 | public function prompt_tone() |
49 | { |
50 | return $this->belongsTo(PromptTone::class, 'prompt_tone_id'); |
51 | } |
52 | |
53 | public function user() |
54 | { |
55 | return $this->belongsTo(User::class, 'user_id'); |
56 | } |
57 | |
58 | /** |
59 | * The "booting" method of the model. |
60 | */ |
61 | protected static function boot(): void |
62 | { |
63 | parent::boot(); |
64 | // Return only personas belonging to the logged in user |
65 | static::addGlobalScope(new UserScope); |
66 | } |
67 | } |