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