SparePartOrdersView.php 604 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class SparePartOrdersView extends Model
  5. {
  6. protected $table = 'spare_part_orders_view';
  7. public $timestamps = false;
  8. const DEFAULT_SORT_BY = 'created_at';
  9. protected $casts = [
  10. 'with_documents' => 'boolean',
  11. 'ordered_quantity' => 'integer',
  12. 'available_qty' => 'integer',
  13. 'year' => 'integer',
  14. ];
  15. /**
  16. * @deprecated Используйте available_qty
  17. */
  18. public function getRemainingQuantityAttribute(): int
  19. {
  20. return $this->available_qty ?? 0;
  21. }
  22. }