*/ protected $fillable = [ 'project_id', 'user_id', 'provider_id', 'model_id', 'generated_prompt', 'input_data', 'output_data', 'tokens_used', 'generation_time', 'status', ]; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'input_data' => 'array', 'output_data' => 'array', 'tokens_used' => 'integer', 'generation_time' => 'decimal:3', ]; } /** * Get the prompt project that owns the generation. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\App\Models\PromptProject, \App\Models\PromptGeneration> */ public function project(): BelongsTo { return $this->belongsTo(PromptProject::class); } /** * Get the user that owns the generation. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\App\Models\User, \App\Models\PromptGeneration> */ public function user(): BelongsTo { return $this->belongsTo(User::class); } /** * Get the AI provider for the generation. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\App\Models\AiProvider, \App\Models\PromptGeneration> */ public function provider(): BelongsTo { return $this->belongsTo(AiProvider::class); } /** * Get the AI model for the generation. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\App\Models\AiModel, \App\Models\PromptGeneration> */ public function model(): BelongsTo { return $this->belongsTo(AiModel::class); } }