101 lines
2.5 KiB
PHP
Executable File
101 lines
2.5 KiB
PHP
Executable File
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class PromptProject extends Model
|
|
{
|
|
use \Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var list<string>
|
|
*/
|
|
protected $fillable = [
|
|
'user_id',
|
|
'title',
|
|
'company_name',
|
|
'company_address',
|
|
'company_whatsapp',
|
|
'company_website',
|
|
'company_social_media',
|
|
'company_business_activities',
|
|
'company_services_products',
|
|
'objective',
|
|
'context',
|
|
'persona',
|
|
'tone',
|
|
'constraints',
|
|
'output_format',
|
|
'examples',
|
|
'variables',
|
|
'temperature',
|
|
'max_tokens',
|
|
'provider_id',
|
|
'model_id',
|
|
'generated_prompt',
|
|
'status',
|
|
];
|
|
|
|
/**
|
|
* Get the attributes that should be cast.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'examples' => 'array',
|
|
'variables' => 'array',
|
|
'temperature' => 'decimal:2',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the user that owns the prompt project.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\App\Models\User, \App\Models\PromptProject>
|
|
*/
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
/**
|
|
* Get the AI provider for the prompt project.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\App\Models\AiProvider, \App\Models\PromptProject>
|
|
*/
|
|
public function provider(): BelongsTo
|
|
{
|
|
return $this->belongsTo(AiProvider::class);
|
|
}
|
|
|
|
/**
|
|
* Get the AI model for the prompt project.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\App\Models\AiModel, \App\Models\PromptProject>
|
|
*/
|
|
public function model(): BelongsTo
|
|
{
|
|
return $this->belongsTo(AiModel::class);
|
|
}
|
|
|
|
/**
|
|
* Get all of the generations for the prompt project.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\App\Models\PromptGeneration>
|
|
*/
|
|
public function generations(): HasMany
|
|
{
|
|
return $this->hasMany(PromptGeneration::class);
|
|
}
|
|
}
|