You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

InvoiceStatusHistory.php 918B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App\Models\Accounting;
  3. use App\Concerns\CompanyOwned;
  4. use App\Enums\Accounting\InvoiceStatus;
  5. use App\Models\User;
  6. use Illuminate\Database\Eloquent\Factories\HasFactory;
  7. use Illuminate\Database\Eloquent\Model;
  8. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  9. class InvoiceStatusHistory extends Model
  10. {
  11. use CompanyOwned;
  12. use HasFactory;
  13. protected $fillable = [
  14. 'company_id',
  15. 'invoice_id',
  16. 'old_status',
  17. 'new_status',
  18. 'changed_by',
  19. 'changed_at',
  20. ];
  21. protected $casts = [
  22. 'changed_at' => 'datetime',
  23. 'old_status' => InvoiceStatus::class,
  24. 'new_status' => InvoiceStatus::class,
  25. ];
  26. public function invoice(): BelongsTo
  27. {
  28. return $this->belongsTo(Invoice::class);
  29. }
  30. public function changedBy(): BelongsTo
  31. {
  32. return $this->belongsTo(User::class, 'changed_by');
  33. }
  34. }