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.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. 'number_digits' => '5',
  25. 'number_next' => '1',
  26. 'payment_terms' => '30',
  27. 'accent_color' => '#007BFF',
  28. 'template' => 'default',
  29. 'item_column' => 'items',
  30. 'unit_column' => 'quantity',
  31. 'price_column' => 'price',
  32. 'amount_column' => 'amount',
  33. ];
  34. }
  35. /**
  36. * Indicate that the model's type is invoice.
  37. */
  38. public function invoice(): self
  39. {
  40. return $this->state(function (array $attributes) {
  41. return [
  42. 'type' => 'invoice',
  43. 'number_prefix' => 'INV-',
  44. ];
  45. });
  46. }
  47. /**
  48. * Indicate that the model's type is bill.
  49. */
  50. public function bill(): self
  51. {
  52. return $this->state(function (array $attributes) {
  53. return [
  54. 'type' => 'bill',
  55. 'number_prefix' => 'BILL-',
  56. ];
  57. });
  58. }
  59. }