| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\SoftDeletes;
- class Comment extends Model
- {
- use HasFactory, SoftDeletes;
- protected $fillable = [
- 'submission_id',
- 'author',
- 'content',
- ];
- protected $casts = [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- ];
- // Связь многие-к-одному: комментарий принадлежит заявке
- public function submission()
- {
- return $this->belongsTo(Submission::class);
- }
- // Полиморфная связь: комментарий может иметь вложения
- public function attachments()
- {
- return $this->morphMany(Attachment::class, 'attachable');
- }
- }
|