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.

DocumentDefaultFactory.php 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace Database\Factories;
  3. use App\Models\Setting\DocumentDefault;
  4. use Illuminate\Database\Eloquent\Factories\Factory;
  5. /**
  6. * @extends Factory<DocumentDefault>
  7. */
  8. class DocumentDefaultFactory extends Factory
  9. {
  10. /**
  11. * The name of the factory's corresponding model.
  12. *
  13. * @var string
  14. */
  15. protected $model = DocumentDefault::class;
  16. /**
  17. * Define the model's default state.
  18. *
  19. * @return array<string, mixed>
  20. */
  21. public function definition(): array
  22. {
  23. return [
  24. 'document_number_digits' => '5',
  25. 'document_number_next' => '1',
  26. 'payment_terms' => '30',
  27. 'template' => 'default',
  28. ];
  29. }
  30. /**
  31. * Indicate that the model's type is invoice.
  32. */
  33. public function invoice(): self
  34. {
  35. return $this->state(function (array $attributes) {
  36. return [
  37. 'type' => 'invoice',
  38. 'document_number_prefix' => 'INV-',
  39. ];
  40. });
  41. }
  42. /**
  43. * Indicate that the model's type is bill.
  44. */
  45. public function bill(): self
  46. {
  47. return $this->state(function (array $attributes) {
  48. return [
  49. 'type' => 'bill',
  50. 'document_number_prefix' => 'BILL-',
  51. ];
  52. });
  53. }
  54. }