Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
22.22% |
2 / 9 |
|
12.50% |
1 / 8 |
CRAP | |
0.00% |
0 / 1 |
| CustomPrompts | |
22.22% |
2 / 9 |
|
12.50% |
1 / 8 |
38.11 | |
0.00% |
0 / 1 |
| boot | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| user | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| template_prompt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| prompt_company_new_update | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| prompt_personal_milestone | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| prompt_tone | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| prompt_language | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| prompt_length_of_post | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Models\Prompts; |
| 4 | |
| 5 | use App\Http\Models\AIPrompts; |
| 6 | use App\Http\Models\Auth\User; |
| 7 | use App\Http\Models\Moloquent; |
| 8 | use App\Http\Models\PromptCompanyNewUpdate; |
| 9 | use App\Http\Models\PromptLanguage; |
| 10 | use App\Http\Models\PromptLengthOfPost; |
| 11 | use App\Http\Models\PromptPersonalMilestone; |
| 12 | use App\Http\Models\PromptTone; |
| 13 | use App\Http\Scopes\UserScope; |
| 14 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
| 15 | use MongoDB\Laravel\Eloquent\SoftDeletes; |
| 16 | |
| 17 | class CustomPrompts extends Moloquent |
| 18 | { |
| 19 | use HasFactory, SoftDeletes; |
| 20 | |
| 21 | protected $table = 'custom_prompts'; |
| 22 | |
| 23 | protected $fillable = [ |
| 24 | 'user_id', |
| 25 | 'name', |
| 26 | 'feature', |
| 27 | 'context', |
| 28 | 'template_prompt_id', |
| 29 | 'persona_id', |
| 30 | 'topic', |
| 31 | 'insert_role', |
| 32 | 'prompt_company_new_update_id', |
| 33 | 'prompt_personal_milestone_id', |
| 34 | 'prompt_tone_id', |
| 35 | 'prompt_language_id', |
| 36 | 'length_of_post_id', |
| 37 | 'youtube_url', |
| 38 | 'blog_url', |
| 39 | 'include_hashtags', |
| 40 | 'include_emojis', |
| 41 | 'additional_instructions', |
| 42 | 'quick_insert', |
| 43 | ]; |
| 44 | |
| 45 | /** |
| 46 | * The attributes that should be cast. |
| 47 | * |
| 48 | * @var array<string, string> |
| 49 | */ |
| 50 | protected $casts = [ |
| 51 | 'quick_insert' => 'boolean', |
| 52 | ]; |
| 53 | |
| 54 | /** |
| 55 | * The attributes that should be hidden for arrays. |
| 56 | * |
| 57 | * @var array |
| 58 | */ |
| 59 | protected $hidden = []; |
| 60 | |
| 61 | /** |
| 62 | * The accessors to append to the model's array form. |
| 63 | * |
| 64 | * @var array |
| 65 | */ |
| 66 | protected $appends = []; |
| 67 | |
| 68 | /** |
| 69 | * The "booting" method of the model. |
| 70 | */ |
| 71 | protected static function boot(): void |
| 72 | { |
| 73 | parent::boot(); |
| 74 | // Return only personas belonging to the logged in user |
| 75 | static::addGlobalScope(new UserScope); |
| 76 | } |
| 77 | |
| 78 | public function user() |
| 79 | { |
| 80 | return $this->belongsTo(User::class, 'user_id'); |
| 81 | } |
| 82 | |
| 83 | public function template_prompt() |
| 84 | { |
| 85 | return $this->belongsTo(AIPrompts::class, 'template_prompt_id'); |
| 86 | } |
| 87 | |
| 88 | public function prompt_company_new_update() |
| 89 | { |
| 90 | return $this->belongsTo(PromptCompanyNewUpdate::class, 'prompt_company_new_update_id'); |
| 91 | } |
| 92 | |
| 93 | public function prompt_personal_milestone() |
| 94 | { |
| 95 | return $this->belongsTo(PromptPersonalMilestone::class, 'prompt_personal_milestone_id'); |
| 96 | } |
| 97 | |
| 98 | public function prompt_tone() |
| 99 | { |
| 100 | return $this->belongsTo(PromptTone::class, 'tone_id'); |
| 101 | } |
| 102 | |
| 103 | public function prompt_language() |
| 104 | { |
| 105 | return $this->belongsTo(PromptLanguage::class, 'prompt_language_id'); |
| 106 | } |
| 107 | |
| 108 | public function prompt_length_of_post() |
| 109 | { |
| 110 | return $this->belongsTo(PromptLengthOfPost::class, 'length_of_post_id'); |
| 111 | } |
| 112 | } |