diff --git a/app/Models/Membership.php b/app/Models/Membership.php index 2c1e01a..bf09423 100644 --- a/app/Models/Membership.php +++ b/app/Models/Membership.php @@ -4,11 +4,12 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\SoftDeletes; use Veelasky\LaravelHashId\Eloquent\HashableId; class Membership extends Model { - use HashableId; + use HashableId, SoftDeletes; protected $guarded = ['id']; diff --git a/app/Models/Payment.php b/app/Models/Payment.php index eedc43b..938949a 100644 --- a/app/Models/Payment.php +++ b/app/Models/Payment.php @@ -6,9 +6,12 @@ use App\Enums\PaymentStatus; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\SoftDeletes; class Payment extends Model { + use SoftDeletes; + protected $guarded = ['id']; protected function casts(): array @@ -16,7 +19,7 @@ protected function casts(): array return [ 'method' => PaymentMethod::class, 'amount' => 'int', - 'payment' => PaymentStatus::class, + 'status' => PaymentStatus::class, ]; } diff --git a/app/Models/StockOpname.php b/app/Models/StockOpname.php index 9dab412..be80262 100644 --- a/app/Models/StockOpname.php +++ b/app/Models/StockOpname.php @@ -3,6 +3,7 @@ namespace App\Models; use App\Enums\StockOpnameStatus; +use Dyrynda\Database\Support\CascadeSoftDeletes; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; @@ -11,7 +12,7 @@ class StockOpname extends Model { - use HashableId, SoftDeletes; + use CascadeSoftDeletes, HashableId, SoftDeletes; protected $table = 'stock_opname'; diff --git a/app/Models/User.php b/app/Models/User.php index ec885ed..b7bf5a0 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -97,6 +97,11 @@ public function payrolls(): HasMany return $this->hasMany(Payroll::class); } + public function expenses(): HasMany + { + return $this->hasMany(Expense::class); + } + public function orders(): HasMany { return $this->hasMany(Order::class); @@ -117,6 +122,11 @@ public function payments(): HasMany return $this->hasMany(Payment::class); } + public function salaryHistories(): HasMany + { + return $this->hasMany(SalaryHistory::class); + } + public function priceRequests(): HasMany { return $this->hasMany(PriceRequest::class); @@ -132,6 +142,11 @@ public function pointRecords(): HasMany return $this->hasMany(PointRecord::class); } + public function stockOpnameItems(): HasMany + { + return $this->hasMany(StockOpnameItem::class); + } + public function pushNotifications(): HasMany { return $this->hasMany(PushNotification::class); diff --git a/app/Models/UserVoucher.php b/app/Models/UserVoucher.php index 04f4277..bc88480 100644 --- a/app/Models/UserVoucher.php +++ b/app/Models/UserVoucher.php @@ -8,6 +8,8 @@ class UserVoucher extends Model { protected $table = 'user_voucher'; + protected $guarded = ['id']; + protected function casts(): array { return [ diff --git a/database/factories/ArticleFactory.php b/database/factories/ArticleFactory.php new file mode 100644 index 0000000..023308b --- /dev/null +++ b/database/factories/ArticleFactory.php @@ -0,0 +1,40 @@ +faker->sentence(6); + + return [ + 'author_id' => User::factory(), + 'title' => $title, + 'slug' => Str::slug($title.'-'.$this->faker->unique()->randomNumber()), + 'excerpt' => $this->faker->paragraph(), + 'content' => $this->faker->paragraphs(3, true), + 'status' => ArticleStatus::PUBLISHED, + 'published_at' => $this->faker->optional()->dateTimeBetween('-10 days', 'now'), + 'views' => $this->faker->numberBetween(0, 1000), + ]; + } + + public function draft(): Factory + { + return $this->state(fn () => ['status' => ArticleStatus::DRAFT, 'published_at' => null]); + } + + public function published(): Factory + { + return $this->state(fn () => ['status' => ArticleStatus::PUBLISHED, 'published_at' => now()]); + } +} diff --git a/database/factories/BottleFactory.php b/database/factories/BottleFactory.php index d2a84a3..98e4f3b 100644 --- a/database/factories/BottleFactory.php +++ b/database/factories/BottleFactory.php @@ -2,13 +2,13 @@ namespace Database\Factories; +use App\Models\Bottle; use Illuminate\Database\Eloquent\Factories\Factory; -/** - * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Bottle> - */ class BottleFactory extends Factory { + protected $model = Bottle::class; + public function definition(): array { $costPrice = $this->faker->randomNumber(2); diff --git a/database/factories/BottleOutletFactory.php b/database/factories/BottleOutletFactory.php new file mode 100644 index 0000000..35c1099 --- /dev/null +++ b/database/factories/BottleOutletFactory.php @@ -0,0 +1,22 @@ + Bottle::factory(), + 'outlet_id' => Outlet::factory(), + 'stock' => $this->faker->numberBetween(0, 200), + ]; + } +} diff --git a/database/factories/BrandFactory.php b/database/factories/BrandFactory.php index 3cd7d31..acf637d 100644 --- a/database/factories/BrandFactory.php +++ b/database/factories/BrandFactory.php @@ -7,6 +7,8 @@ class BrandFactory extends Factory { + protected $model = Brand::class; + public function definition(): array { return [ diff --git a/database/factories/BroadcastAudienceFactory.php b/database/factories/BroadcastAudienceFactory.php new file mode 100644 index 0000000..845bf8b --- /dev/null +++ b/database/factories/BroadcastAudienceFactory.php @@ -0,0 +1,21 @@ + Broadcast::factory(), + 'user_id' => User::factory(), + ]; + } +} diff --git a/database/factories/BroadcastFactory.php b/database/factories/BroadcastFactory.php new file mode 100644 index 0000000..b31dc09 --- /dev/null +++ b/database/factories/BroadcastFactory.php @@ -0,0 +1,21 @@ + User::factory(), + 'title' => $this->faker->sentence(4), + 'body' => $this->faker->paragraph(), + ]; + } +} diff --git a/database/factories/CategoryFactory.php b/database/factories/CategoryFactory.php index 7b4f951..c986aec 100644 --- a/database/factories/CategoryFactory.php +++ b/database/factories/CategoryFactory.php @@ -7,6 +7,8 @@ class CategoryFactory extends Factory { + protected $model = Category::class; + public function definition(): array { return [ diff --git a/database/factories/CategoryPerfumeFactory.php b/database/factories/CategoryPerfumeFactory.php new file mode 100644 index 0000000..a335294 --- /dev/null +++ b/database/factories/CategoryPerfumeFactory.php @@ -0,0 +1,21 @@ + Category::factory(), + 'perfume_id' => Perfume::factory(), + ]; + } +} diff --git a/database/factories/ChooseUsFactory.php b/database/factories/ChooseUsFactory.php new file mode 100644 index 0000000..48d92b6 --- /dev/null +++ b/database/factories/ChooseUsFactory.php @@ -0,0 +1,20 @@ + $this->faker->words(2, true), + 'description' => $this->faker->paragraph(), + 'sort_order' => $this->faker->numberBetween(1, 50), + ]; + } +} diff --git a/database/factories/CustomerFactory.php b/database/factories/CustomerFactory.php index 2d1f1ce..691b2cd 100644 --- a/database/factories/CustomerFactory.php +++ b/database/factories/CustomerFactory.php @@ -3,10 +3,13 @@ namespace Database\Factories; use App\Enums\Gender; +use App\Models\Customer; use Illuminate\Database\Eloquent\Factories\Factory; class CustomerFactory extends Factory { + protected $model = Customer::class; + public function definition(): array { return [ diff --git a/database/factories/EmployeeFactory.php b/database/factories/EmployeeFactory.php index c449696..f656c04 100644 --- a/database/factories/EmployeeFactory.php +++ b/database/factories/EmployeeFactory.php @@ -9,6 +9,8 @@ class EmployeeFactory extends Factory { + protected $model = Employee::class; + public function definition(): array { return [ @@ -38,46 +40,26 @@ public function definition(): array public function male(): Factory { - return $this->state(function (array $attributes) { - return [ - 'gender' => Gender::MALE, - ]; - }); + return $this->state(fn () => ['gender' => Gender::MALE]); } public function female(): Factory { - return $this->state(function (array $attributes) { - return [ - 'gender' => Gender::FEMALE, - ]; - }); + return $this->state(fn () => ['gender' => Gender::FEMALE]); } public function permanent(): Factory { - return $this->state(function (array $attributes) { - return [ - 'status' => EmploymentStatus::PERMANENT, - ]; - }); + return $this->state(fn () => ['status' => EmploymentStatus::PERMANENT]); } public function contract(): Factory { - return $this->state(function (array $attributes) { - return [ - 'status' => EmploymentStatus::CONTRACT, - ]; - }); + return $this->state(fn () => ['status' => EmploymentStatus::CONTRACT]); } public function intern(): Factory { - return $this->state(function (array $attributes) { - return [ - 'status' => EmploymentStatus::INTERN, - ]; - }); + return $this->state(fn () => ['status' => EmploymentStatus::INTERN]); } } diff --git a/database/factories/ExpenseFactory.php b/database/factories/ExpenseFactory.php new file mode 100644 index 0000000..585a678 --- /dev/null +++ b/database/factories/ExpenseFactory.php @@ -0,0 +1,40 @@ + User::factory(), + 'outlet_id' => Outlet::factory(), + 'amount' => $this->faker->numberBetween(10000, 200000), + 'description' => $this->faker->sentence(6), + 'type' => ExpenseType::OPERATIONAL, + ]; + } + + public function operational(): Factory + { + return $this->state(fn () => ['type' => ExpenseType::OPERATIONAL]); + } + + public function purchase(): Factory + { + return $this->state(fn () => ['type' => ExpenseType::PURCHASE]); + } + + public function salary(): Factory + { + return $this->state(fn () => ['type' => ExpenseType::SALARY]); + } +} diff --git a/database/factories/FacilityFactory.php b/database/factories/FacilityFactory.php index fe27d8a..870043d 100644 --- a/database/factories/FacilityFactory.php +++ b/database/factories/FacilityFactory.php @@ -2,10 +2,13 @@ namespace Database\Factories; +use App\Models\Facility; use Illuminate\Database\Eloquent\Factories\Factory; class FacilityFactory extends Factory { + protected $model = Facility::class; + public function definition(): array { return [ diff --git a/database/factories/FaqFactory.php b/database/factories/FaqFactory.php new file mode 100644 index 0000000..a87c601 --- /dev/null +++ b/database/factories/FaqFactory.php @@ -0,0 +1,20 @@ + $this->faker->sentence(6), + 'answer' => $this->faker->paragraph(), + 'sort_order' => $this->faker->numberBetween(1, 50), + ]; + } +} diff --git a/database/factories/FormulaFactory.php b/database/factories/FormulaFactory.php index 5ee7f96..1d24b33 100644 --- a/database/factories/FormulaFactory.php +++ b/database/factories/FormulaFactory.php @@ -2,13 +2,13 @@ namespace Database\Factories; +use App\Models\Formula; use Illuminate\Database\Eloquent\Factories\Factory; -/** - * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Formula> - */ class FormulaFactory extends Factory { + protected $model = Formula::class; + public function definition(): array { return [ diff --git a/database/factories/MembershipFactory.php b/database/factories/MembershipFactory.php new file mode 100644 index 0000000..b3f2aef --- /dev/null +++ b/database/factories/MembershipFactory.php @@ -0,0 +1,24 @@ + User::factory(), + 'tier_id' => Tier::factory(), + 'tier_points' => $this->faker->numberBetween(0, 1000), + 'reward_points' => $this->faker->numberBetween(0, 1000), + 'last_transaction_at' => $this->faker->optional()->dateTimeBetween('-30 days', 'now'), + ]; + } +} diff --git a/database/factories/OpeningHourFactory.php b/database/factories/OpeningHourFactory.php index e38f326..9b1585b 100644 --- a/database/factories/OpeningHourFactory.php +++ b/database/factories/OpeningHourFactory.php @@ -3,10 +3,13 @@ namespace Database\Factories; use App\Enums\Day; +use App\Models\OpeningHour; use Illuminate\Database\Eloquent\Factories\Factory; class OpeningHourFactory extends Factory { + protected $model = OpeningHour::class; + public function definition(): array { return [ diff --git a/database/factories/OrderFactory.php b/database/factories/OrderFactory.php index 18ade40..889470e 100644 --- a/database/factories/OrderFactory.php +++ b/database/factories/OrderFactory.php @@ -5,6 +5,7 @@ use App\Enums\OrderChannel; use App\Enums\OrderStatus; use App\Models\Customer; +use App\Models\Order; use App\Models\Outlet; use App\Models\User; use App\Models\Voucher; @@ -12,6 +13,8 @@ class OrderFactory extends Factory { + protected $model = Order::class; + public function definition(): array { $subtotal = $this->faker->numberBetween(50000, 1000000); @@ -40,183 +43,91 @@ public function definition(): array ]; } - /* - |-------------------------------------------------------------------------- - | Status States - |-------------------------------------------------------------------------- - */ - public function draft(): Factory { - return $this->state(function (array $attributes) { - return [ - 'status' => OrderStatus::DRAFT, - ]; - }); + return $this->state(fn () => ['status' => OrderStatus::DRAFT]); } public function pending(): Factory { - return $this->state(function (array $attributes) { - return [ - 'status' => OrderStatus::PENDING, - ]; - }); + return $this->state(fn () => ['status' => OrderStatus::PENDING]); } public function partial(): Factory { - return $this->state(function (array $attributes) { - return [ - 'status' => OrderStatus::PARTIAL, - ]; - }); + return $this->state(fn () => ['status' => OrderStatus::PARTIAL]); } public function paid(): Factory { - return $this->state(function (array $attributes) { - return [ - 'status' => OrderStatus::PAID, - ]; - }); + return $this->state(fn () => ['status' => OrderStatus::PAID]); } public function overdue(): Factory { - return $this->state(function (array $attributes) { - return [ - 'status' => OrderStatus::OVERDUE, - ]; - }); + return $this->state(fn () => ['status' => OrderStatus::OVERDUE]); } public function canceled(): Factory { - return $this->state(function (array $attributes) { - return [ - 'status' => OrderStatus::CANCELED, - ]; - }); + return $this->state(fn () => ['status' => OrderStatus::CANCELED]); } - /* - |-------------------------------------------------------------------------- - | Channel States - |-------------------------------------------------------------------------- - */ - public function outlet(): Factory { - return $this->state(function (array $attributes) { - return [ - 'channel' => OrderChannel::OUTLET, - ]; - }); + return $this->state(fn () => ['channel' => OrderChannel::OUTLET]); } public function shopee(): Factory { - return $this->state(function (array $attributes) { - return [ - 'channel' => OrderChannel::SHOPEE, - ]; - }); + return $this->state(fn () => ['channel' => OrderChannel::SHOPEE]); } public function tokopedia(): Factory { - return $this->state(function (array $attributes) { - return [ - 'channel' => OrderChannel::TOKOPEDIA, - ]; - }); + return $this->state(fn () => ['channel' => OrderChannel::TOKOPEDIA]); } public function website(): Factory { - return $this->state(function (array $attributes) { - return [ - 'channel' => OrderChannel::WEBSITE, - ]; - }); + return $this->state(fn () => ['channel' => OrderChannel::WEBSITE]); } public function instagram(): Factory { - return $this->state(function (array $attributes) { - return [ - 'channel' => OrderChannel::INSTAGRAM, - ]; - }); + return $this->state(fn () => ['channel' => OrderChannel::INSTAGRAM]); } public function whatsapp(): Factory { - return $this->state(function (array $attributes) { - return [ - 'channel' => OrderChannel::WHATSAPP, - ]; - }); + return $this->state(fn () => ['channel' => OrderChannel::WHATSAPP]); } public function other(): Factory { - return $this->state(function (array $attributes) { - return [ - 'channel' => OrderChannel::OTHER, - ]; - }); + return $this->state(fn () => ['channel' => OrderChannel::OTHER]); } - /* - |-------------------------------------------------------------------------- - | Relationship States - |-------------------------------------------------------------------------- - */ - public function withCustomer(?Customer $customer = null): Factory { - return $this->state(function (array $attributes) use ($customer) { - return [ - 'customer_id' => $customer?->id ?? Customer::factory(), - ]; - }); + return $this->state(fn () => ['customer_id' => $customer?->id ?? Customer::factory()]); } public function withVoucher(?Voucher $voucher = null): Factory { - return $this->state(function (array $attributes) use ($voucher) { - return [ - 'voucher_id' => $voucher?->id ?? Voucher::factory(), - ]; - }); + return $this->state(fn () => ['voucher_id' => $voucher?->id ?? Voucher::factory()]); } public function withOutlet(?Outlet $outlet = null): Factory { - return $this->state(function (array $attributes) use ($outlet) { - return [ - 'outlet_id' => $outlet?->id ?? Outlet::factory(), - ]; - }); + return $this->state(fn () => ['outlet_id' => $outlet?->id ?? Outlet::factory()]); } public function withUser(?User $user = null): Factory { - return $this->state(function (array $attributes) use ($user) { - return [ - 'user_id' => $user?->id ?? User::factory(), - ]; - }); + return $this->state(fn () => ['user_id' => $user?->id ?? User::factory()]); } - /* - |-------------------------------------------------------------------------- - | Financial States - |-------------------------------------------------------------------------- - */ - public function withAmounts(int $subtotal, ?int $discount = null, ?int $cogs = null): Factory { return $this->state(function (array $attributes) use ($subtotal, $discount, $cogs) { @@ -241,7 +152,7 @@ public function withDiscount(int $discount): Factory return [ 'discount' => $discount, - 'total' => max(0, $total), // Ensure total is not negative + 'total' => max(0, $total), ]; }); } @@ -258,58 +169,28 @@ public function withoutDiscount(): Factory }); } - /* - |-------------------------------------------------------------------------- - | Date States - |-------------------------------------------------------------------------- - */ - public function today(): Factory { - return $this->state(function (array $attributes) { - return [ - 'ordered_at' => now(), - 'created_at' => now(), - ]; - }); + return $this->state(fn () => ['ordered_at' => now(), 'created_at' => now()]); } public function yesterday(): Factory { - return $this->state(function (array $attributes) { - $yesterday = now()->subDay(); - - return [ - 'ordered_at' => $yesterday, - 'created_at' => $yesterday, - ]; - }); + return $this->state(fn () => tap(now()->subDay(), fn ($d) => null) && ['ordered_at' => $d = now()->subDay(), 'created_at' => $d]); } public function thisWeek(): Factory { - return $this->state(function (array $attributes) { - return [ - 'ordered_at' => $this->faker->dateTimeBetween('-7 days', 'now'), - ]; - }); + return $this->state(fn () => ['ordered_at' => $this->faker->dateTimeBetween('-7 days', 'now')]); } public function thisMonth(): Factory { - return $this->state(function (array $attributes) { - return [ - 'ordered_at' => $this->faker->dateTimeBetween('-30 days', 'now'), - ]; - }); + return $this->state(fn () => ['ordered_at' => $this->faker->dateTimeBetween('-30 days', 'now')]); } public function lastMonth(): Factory { - return $this->state(function (array $attributes) { - return [ - 'ordered_at' => $this->faker->dateTimeBetween('-60 days', '-30 days'), - ]; - }); + return $this->state(fn () => ['ordered_at' => $this->faker->dateTimeBetween('-60 days', '-30 days')]); } } diff --git a/database/factories/OrderItemFactory.php b/database/factories/OrderItemFactory.php new file mode 100644 index 0000000..362398a --- /dev/null +++ b/database/factories/OrderItemFactory.php @@ -0,0 +1,29 @@ +faker->numberBetween(20000, 150000); + $quantity = $this->faker->numberBetween(1, 5); + + return [ + 'order_id' => Order::factory(), + 'user_id' => User::factory(), + 'orderable_type' => null, + 'orderable_id' => null, + 'cogs' => (int) ($unitPrice * 0.4), + 'unit_price' => $unitPrice, + 'quantity' => $quantity, + ]; + } +} diff --git a/database/factories/OutletFactory.php b/database/factories/OutletFactory.php index 03fd64b..524273a 100644 --- a/database/factories/OutletFactory.php +++ b/database/factories/OutletFactory.php @@ -3,10 +3,13 @@ namespace Database\Factories; use App\Enums\OutletStatus; +use App\Models\Outlet; use Illuminate\Database\Eloquent\Factories\Factory; class OutletFactory extends Factory { + protected $model = Outlet::class; + public function definition(): array { return [ @@ -31,28 +34,16 @@ public function definition(): array public function operational(): Factory { - return $this->state(function (array $attributes) { - return [ - 'status' => OutletStatus::OPERATIONAL, - ]; - }); + return $this->state(fn () => ['status' => OutletStatus::OPERATIONAL]); } public function underConstruction(): Factory { - return $this->state(function (array $attributes) { - return [ - 'status' => OutletStatus::UNDER_CONSTRUCTION, - ]; - }); + return $this->state(fn () => ['status' => OutletStatus::UNDER_CONSTRUCTION]); } public function terminated(): Factory { - return $this->state(function (array $attributes) { - return [ - 'status' => OutletStatus::TERMINATED, - ]; - }); + return $this->state(fn () => ['status' => OutletStatus::TERMINATED]); } } diff --git a/database/factories/OutletPerfumeFactory.php b/database/factories/OutletPerfumeFactory.php new file mode 100644 index 0000000..614f254 --- /dev/null +++ b/database/factories/OutletPerfumeFactory.php @@ -0,0 +1,22 @@ + Outlet::factory(), + 'perfume_id' => Perfume::factory(), + 'stock' => $this->faker->numberBetween(0, 500), + ]; + } +} diff --git a/database/factories/OutletProductFactory.php b/database/factories/OutletProductFactory.php new file mode 100644 index 0000000..d3da003 --- /dev/null +++ b/database/factories/OutletProductFactory.php @@ -0,0 +1,22 @@ + Outlet::factory(), + 'product_id' => Product::factory(), + 'stock' => $this->faker->numberBetween(0, 500), + ]; + } +} diff --git a/database/factories/OutletUserFactory.php b/database/factories/OutletUserFactory.php new file mode 100644 index 0000000..b647d3d --- /dev/null +++ b/database/factories/OutletUserFactory.php @@ -0,0 +1,21 @@ + Outlet::factory(), + 'user_id' => User::factory(), + ]; + } +} diff --git a/database/factories/OutletVoucherFactory.php b/database/factories/OutletVoucherFactory.php new file mode 100644 index 0000000..93897ce --- /dev/null +++ b/database/factories/OutletVoucherFactory.php @@ -0,0 +1,21 @@ + Outlet::factory(), + 'voucher_id' => Voucher::factory(), + ]; + } +} diff --git a/database/factories/PaymentFactory.php b/database/factories/PaymentFactory.php new file mode 100644 index 0000000..db99226 --- /dev/null +++ b/database/factories/PaymentFactory.php @@ -0,0 +1,47 @@ + Order::factory(), + 'user_id' => User::factory(), + 'method' => PaymentMethod::CASH, + 'amount' => $this->faker->numberBetween(20000, 400000), + 'paid_at' => $this->faker->dateTimeBetween('-7 days', 'now'), + 'status' => PaymentStatus::PENDING, + ]; + } + + public function cash(): Factory + { + return $this->state(fn () => ['method' => PaymentMethod::CASH]); + } + + public function transfer(): Factory + { + return $this->state(fn () => ['method' => PaymentMethod::TRANSFER]); + } + + public function paid(): Factory + { + return $this->state(fn () => ['status' => PaymentStatus::PAID]); + } + + public function pending(): Factory + { + return $this->state(fn () => ['status' => PaymentStatus::PENDING]); + } +} diff --git a/database/factories/PayrollAdjustmentFactory.php b/database/factories/PayrollAdjustmentFactory.php new file mode 100644 index 0000000..058a09e --- /dev/null +++ b/database/factories/PayrollAdjustmentFactory.php @@ -0,0 +1,33 @@ + Payroll::factory(), + 'type' => SalaryAdjustmentType::BONUS, + 'description' => $this->faker->sentence(4), + 'amount' => $this->faker->numberBetween(50000, 500000), + ]; + } + + public function deduction(): Factory + { + return $this->state(fn () => ['type' => SalaryAdjustmentType::DEDUCTION]); + } + + public function bonus(): Factory + { + return $this->state(fn () => ['type' => SalaryAdjustmentType::BONUS]); + } +} diff --git a/database/factories/PayrollFactory.php b/database/factories/PayrollFactory.php new file mode 100644 index 0000000..79eefdc --- /dev/null +++ b/database/factories/PayrollFactory.php @@ -0,0 +1,39 @@ +faker->numberBetween(3000000, 8000000); + $bonus = $this->faker->numberBetween(0, 2000000); + $deduction = $this->faker->numberBetween(0, 500000); + + return [ + 'user_id' => User::factory(), + 'period_month' => $this->faker->date('Y-m'), + 'base_salary' => $base, + 'bonus' => $bonus, + 'deduction' => $deduction, + 'total_salary' => $base + $bonus - $deduction, + 'is_paid' => IsPaid::NOT_PAID, + 'paid_at' => null, + ]; + } + + public function paid(): Factory + { + return $this->state(fn () => [ + 'is_paid' => IsPaid::PAID, + 'paid_at' => $this->faker->dateTimeBetween('-3 days', 'now'), + ]); + } +} diff --git a/database/factories/PerfumeFactory.php b/database/factories/PerfumeFactory.php new file mode 100644 index 0000000..260e502 --- /dev/null +++ b/database/factories/PerfumeFactory.php @@ -0,0 +1,44 @@ +faker->unique()->words(2, true); + + return [ + 'brand_id' => Brand::factory(), + 'name' => Str::title($name), + 'slug' => Str::slug($name.'-'.$this->faker->unique()->randomNumber()), + 'sku' => strtoupper($this->faker->unique()->bothify('PER-#####')), + 'concentration' => Concentration::EXTRAIT_DE_PERFUME, + 'cost_price' => $this->faker->numberBetween(50000, 250000), + 'sale_price' => $this->faker->numberBetween(80000, 400000), + 'point_per_ml' => $this->faker->numberBetween(1, 30), + 'base_notes' => $this->faker->optional()->words(3, true), + 'middle_notes' => $this->faker->optional()->words(3, true), + 'top_notes' => $this->faker->optional()->words(3, true), + 'description' => $this->faker->optional()->paragraph(), + ]; + } + + public function extrait(): Factory + { + return $this->state(fn () => ['concentration' => Concentration::EXTRAIT_DE_PERFUME]); + } + + public function eauDeParfum(): Factory + { + return $this->state(fn () => ['concentration' => Concentration::EAU_DE_PERFUME]); + } +} diff --git a/database/factories/PerfumeFeatureFactory.php b/database/factories/PerfumeFeatureFactory.php new file mode 100644 index 0000000..0a6c09a --- /dev/null +++ b/database/factories/PerfumeFeatureFactory.php @@ -0,0 +1,20 @@ + $this->faker->words(2, true), + 'description' => $this->faker->paragraph(), + 'sort_order' => $this->faker->numberBetween(1, 50), + ]; + } +} diff --git a/database/factories/PointRecordFactory.php b/database/factories/PointRecordFactory.php new file mode 100644 index 0000000..c486e69 --- /dev/null +++ b/database/factories/PointRecordFactory.php @@ -0,0 +1,37 @@ +faker->numberBetween(10, 500); + $isAddition = $this->faker->boolean(); + + return [ + 'user_id' => User::factory(), + 'change' => $change, + 'type' => PointRecordType::REWARD, + 'description' => $this->faker->sentence(4), + 'is_addition' => $isAddition, + ]; + } + + public function reward(): Factory + { + return $this->state(fn () => ['type' => PointRecordType::REWARD, 'is_addition' => true]); + } + + public function redemption(): Factory + { + return $this->state(fn () => ['type' => PointRecordType::REDEMPTION, 'is_addition' => false]); + } +} diff --git a/database/factories/PriceRequestFactory.php b/database/factories/PriceRequestFactory.php new file mode 100644 index 0000000..18ee993 --- /dev/null +++ b/database/factories/PriceRequestFactory.php @@ -0,0 +1,38 @@ + User::factory(), + 'module' => $this->faker->randomElement(['product', 'perfume', 'bottle']), + 'status' => PriceRequestStatus::PENDING, + 'finalized_at' => null, + ]; + } + + public function pending(): Factory + { + return $this->state(fn () => ['status' => PriceRequestStatus::PENDING, 'finalized_at' => null]); + } + + public function approved(): Factory + { + return $this->state(fn () => ['status' => PriceRequestStatus::APPROVED, 'finalized_at' => $this->faker->dateTime()]); + } + + public function rejected(): Factory + { + return $this->state(fn () => ['status' => PriceRequestStatus::REJECTED, 'finalized_at' => $this->faker->dateTime()]); + } +} diff --git a/database/factories/ProductFactory.php b/database/factories/ProductFactory.php new file mode 100644 index 0000000..70565ae --- /dev/null +++ b/database/factories/ProductFactory.php @@ -0,0 +1,27 @@ +faker->unique()->words(2, true); + + return [ + 'name' => Str::title($name), + 'slug' => Str::slug($name.'-'.$this->faker->unique()->randomNumber()), + 'sku' => strtoupper($this->faker->unique()->bothify('PRD-#####')), + 'cost_price' => $this->faker->numberBetween(20000, 150000), + 'sale_price' => $this->faker->numberBetween(30000, 200000), + 'point_per_pcs' => $this->faker->numberBetween(1, 50), + 'description' => $this->faker->optional()->paragraph(), + ]; + } +} diff --git a/database/factories/PurchaseFactory.php b/database/factories/PurchaseFactory.php new file mode 100644 index 0000000..201e55f --- /dev/null +++ b/database/factories/PurchaseFactory.php @@ -0,0 +1,24 @@ + Outlet::factory(), + 'invoice_number' => Str::upper($this->faker->bothify('PO-########')), + 'purchase_date' => $this->faker->date(), + 'total' => $this->faker->numberBetween(50000, 500000), + 'note' => $this->faker->optional()->sentence(6), + ]; + } +} diff --git a/database/factories/PurchaseItemFactory.php b/database/factories/PurchaseItemFactory.php new file mode 100644 index 0000000..67cf4e6 --- /dev/null +++ b/database/factories/PurchaseItemFactory.php @@ -0,0 +1,29 @@ +faker->numberBetween(10000, 100000); + $quantity = $this->faker->numberBetween(1, 10); + + return [ + 'purchase_id' => Purchase::factory(), + 'user_id' => User::factory(), + 'purchasable_type' => null, + 'purchasable_id' => null, + 'quantity' => $quantity, + 'unit_price' => $unitPrice, + 'total_price' => $unitPrice * $quantity, + ]; + } +} diff --git a/database/factories/PushNotificationFactory.php b/database/factories/PushNotificationFactory.php new file mode 100644 index 0000000..bd4797d --- /dev/null +++ b/database/factories/PushNotificationFactory.php @@ -0,0 +1,28 @@ + User::factory(), + 'subscriptions' => [ + [ + 'endpoint' => $this->faker->url(), + 'keys' => [ + 'p256dh' => $this->faker->sha256(), + 'auth' => $this->faker->md5(), + ], + ], + ], + ]; + } +} diff --git a/database/factories/ReferralCodeFactory.php b/database/factories/ReferralCodeFactory.php index e1e1160..e95494f 100644 --- a/database/factories/ReferralCodeFactory.php +++ b/database/factories/ReferralCodeFactory.php @@ -2,13 +2,13 @@ namespace Database\Factories; +use App\Models\ReferralCode; use Illuminate\Database\Eloquent\Factories\Factory; -/** - * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\ReferralCode> - */ class ReferralCodeFactory extends Factory { + protected $model = ReferralCode::class; + public function definition(): array { return [ diff --git a/database/factories/ReferralUsageFactory.php b/database/factories/ReferralUsageFactory.php new file mode 100644 index 0000000..fd83f94 --- /dev/null +++ b/database/factories/ReferralUsageFactory.php @@ -0,0 +1,21 @@ + User::factory(), + 'referral_code_id' => ReferralCode::factory(), + ]; + } +} diff --git a/database/factories/SalaryHistoryFactory.php b/database/factories/SalaryHistoryFactory.php new file mode 100644 index 0000000..e12919b --- /dev/null +++ b/database/factories/SalaryHistoryFactory.php @@ -0,0 +1,25 @@ +faker->numberBetween(3000000, 6000000); + $new = $old + $this->faker->numberBetween(-500000, 1000000); + + return [ + 'user_id' => User::factory(), + 'old_salary' => $old, + 'new_salary' => max(0, $new), + 'effective_date' => $this->faker->date(), + ]; + } +} diff --git a/database/factories/StockOpnameFactory.php b/database/factories/StockOpnameFactory.php new file mode 100644 index 0000000..aeb6bb1 --- /dev/null +++ b/database/factories/StockOpnameFactory.php @@ -0,0 +1,33 @@ + Outlet::factory(), + 'period_month' => $this->faker->date('Y-m'), + 'status' => StockOpnameStatus::DRAFT, + 'note' => $this->faker->optional()->sentence(8), + ]; + } + + public function draft(): Factory + { + return $this->state(fn () => ['status' => StockOpnameStatus::DRAFT]); + } + + public function finalized(): Factory + { + return $this->state(fn () => ['status' => StockOpnameStatus::FINALIZED]); + } +} diff --git a/database/factories/StockOpnameItemFactory.php b/database/factories/StockOpnameItemFactory.php new file mode 100644 index 0000000..a0662a3 --- /dev/null +++ b/database/factories/StockOpnameItemFactory.php @@ -0,0 +1,28 @@ +faker->numberBetween(0, 200); + $qtyPhysical = $this->faker->optional()->numberBetween(0, 200); + + return [ + 'stock_opname_id' => StockOpname::factory(), + 'user_id' => User::factory(), + 'itemable_type' => null, + 'itemable_id' => null, + 'qty_system' => $qtySystem, + 'qty_physical' => $qtyPhysical, + ]; + } +} diff --git a/database/factories/TierFactory.php b/database/factories/TierFactory.php index 26725b2..f7e8eb0 100644 --- a/database/factories/TierFactory.php +++ b/database/factories/TierFactory.php @@ -2,10 +2,13 @@ namespace Database\Factories; +use App\Models\Tier; use Illuminate\Database\Eloquent\Factories\Factory; class TierFactory extends Factory { + protected $model = Tier::class; + public function definition(): array { return [ diff --git a/database/factories/TierRewardFactory.php b/database/factories/TierRewardFactory.php new file mode 100644 index 0000000..ab2f453 --- /dev/null +++ b/database/factories/TierRewardFactory.php @@ -0,0 +1,21 @@ + Tier::factory(), + 'name' => $this->faker->words(2, true), + 'value' => $this->faker->numberBetween(10, 500), + ]; + } +} diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index d93b6a9..11a1224 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -3,35 +3,31 @@ namespace Database\Factories; use App\Enums\UserStatus; +use App\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Facades\Hash; class UserFactory extends Factory { + protected $model = User::class; + public function definition(): array { return [ 'email' => $this->faker->unique()->safeEmail(), 'username' => fake()->unique()->regexify('[A-Za-z0-9]{8}'), 'password' => Hash::make(config('myconfig.password_default')), + '', ]; } public function active(): Factory { - return $this->state(function (array $attributes) { - return [ - 'status' => UserStatus::ACTIVE, - ]; - }); + return $this->state(fn () => ['status' => UserStatus::ACTIVE]); } public function inactive(): Factory { - return $this->state(function (array $attributes) { - return [ - 'status' => UserStatus::INACTIVE, - ]; - }); + return $this->state(fn () => ['status' => UserStatus::INACTIVE]); } } diff --git a/database/factories/UserVoucherFactory.php b/database/factories/UserVoucherFactory.php new file mode 100644 index 0000000..49925d8 --- /dev/null +++ b/database/factories/UserVoucherFactory.php @@ -0,0 +1,22 @@ + User::factory(), + 'voucher_id' => Voucher::factory(), + 'quantity' => $this->faker->numberBetween(1, 5), + ]; + } +} diff --git a/database/factories/VolumeItemFactory.php b/database/factories/VolumeItemFactory.php new file mode 100644 index 0000000..838505c --- /dev/null +++ b/database/factories/VolumeItemFactory.php @@ -0,0 +1,21 @@ + OrderItem::factory(), + 'quality' => $this->faker->randomElement(['GOOD', 'OK', 'BAD']), + 'volume' => $this->faker->numberBetween(5, 200), + ]; + } +} diff --git a/database/factories/VoucherFactory.php b/database/factories/VoucherFactory.php index f1e79bb..b7f8777 100644 --- a/database/factories/VoucherFactory.php +++ b/database/factories/VoucherFactory.php @@ -2,7 +2,7 @@ namespace Database\Factories; -use App\Enums\IsActive; +use App\Enums\IsShow; use App\Enums\VoucherType; use App\Models\Voucher; use Illuminate\Database\Eloquent\Factories\Factory; @@ -31,15 +31,17 @@ public function definition(): array 'summary' => $this->faker->sentence(), 'start_date' => $this->faker->dateTimeBetween('tomorrow', '+1 week')->format('Y-m-d'), 'end_date' => $this->faker->optional()->dateTimeBetween('+1 day', '+2 months')?->format('Y-m-d'), + 'is_show' => $this->faker->randomElement(IsShow::values()), ]; } - public function active(): Factory + public function show(): Factory { - return $this->state(function (array $attributes) { - return [ - 'is_active' => IsActive::ACTIVE, - ]; - }); + return $this->state(fn () => ['is_show' => IsShow::SHOW]); + } + + public function hidden(): Factory + { + return $this->state(fn () => ['is_show' => IsShow::HIDDEN]); } } diff --git a/database/migrations/0001_01_01_000000_create_users_table.php b/database/migrations/0001_01_01_000000_create_users_table.php index 3914e2d..7c2bbb0 100644 --- a/database/migrations/0001_01_01_000000_create_users_table.php +++ b/database/migrations/0001_01_01_000000_create_users_table.php @@ -17,7 +17,7 @@ public function up(): void $table->string('email', 100)->unique(); $table->string('username', 20)->unique(); $table->string('password', 97); - $table->enum('status', [UserStatus::values()])->default(UserStatus::ACTIVE)->comment(UserStatus::comment()); + $table->enum('status', UserStatus::values())->default(UserStatus::ACTIVE)->comment(UserStatus::comment()); $table->timestamp('email_verified_at')->nullable(); $table->timestamp('last_login_at')->nullable(); $table->timestamp('last_password_change_at')->nullable(); diff --git a/database/migrations/2025_09_13_034842_create_employees_table.php b/database/migrations/2025_09_13_034842_create_employees_table.php index 1e7daa2..c1bf527 100644 --- a/database/migrations/2025_09_13_034842_create_employees_table.php +++ b/database/migrations/2025_09_13_034842_create_employees_table.php @@ -20,12 +20,12 @@ public function up(): void $table->string('code', 20)->unique(); $table->string('phone_number', 20); $table->unsignedInteger('base_salary')->default(0); - $table->enum('gender', [Gender::values()])->comment(Gender::comment()); + $table->enum('gender', Gender::values())->comment(Gender::comment()); $table->text('address')->nullable(); $table->date('birthdate'); $table->date('hire_date'); $table->date('resign_date')->nullable(); - $table->enum('status', [EmploymentStatus::values()])->default(EmploymentStatus::PERMANENT)->comment(EmploymentStatus::comment()); + $table->enum('status', EmploymentStatus::values())->default(EmploymentStatus::PERMANENT)->comment(EmploymentStatus::comment()); $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->nullable()->useCurrentOnUpdate(); $table->softDeletes(); diff --git a/database/migrations/2025_09_13_045752_create_outlets_table.php b/database/migrations/2025_09_13_045752_create_outlets_table.php index f904153..5696df1 100644 --- a/database/migrations/2025_09_13_045752_create_outlets_table.php +++ b/database/migrations/2025_09_13_045752_create_outlets_table.php @@ -20,7 +20,7 @@ public function up(): void $table->text('address'); $table->string('landmark', 30)->nullable(); $table->text('maps_url')->nullable(); - $table->enum('status', [OutletStatus::values()])->default(OutletStatus::OPERATIONAL)->comment(OutletStatus::comment()); + $table->enum('status', OutletStatus::values())->default(OutletStatus::OPERATIONAL)->comment(OutletStatus::comment()); $table->date('opened_date'); $table->date('closed_date')->nullable(); $table->timestamp('created_at')->useCurrent(); diff --git a/database/migrations/2025_09_25_125559_create_vouchers_table.php b/database/migrations/2025_09_25_125559_create_vouchers_table.php index 032b52e..d60f4bf 100644 --- a/database/migrations/2025_09_25_125559_create_vouchers_table.php +++ b/database/migrations/2025_09_25_125559_create_vouchers_table.php @@ -17,7 +17,7 @@ public function up(): void $table->id(); $table->string('name', 50); $table->string('code', 20)->unique(); - $table->enum('type', [VoucherType::values()])->default(VoucherType::PERCENTAGE)->comment(VoucherType::comment()); + $table->enum('type', VoucherType::values())->default(VoucherType::PERCENTAGE)->comment(VoucherType::comment()); $table->string('tags', 20); $table->string('summary', 200); $table->unsignedInteger('discount_amount'); @@ -28,7 +28,7 @@ public function up(): void $table->unsignedInteger('limit_per_user')->nullable(); $table->date('start_date'); $table->date('end_date')->nullable(); - $table->enum('is_show', [IsShow::values()])->default(IsShow::SHOW)->comment(IsShow::comment()); + $table->enum('is_show', IsShow::values())->default(IsShow::SHOW)->comment(IsShow::comment()); $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->nullable()->useCurrentOnUpdate(); $table->softDeletes(); diff --git a/database/migrations/2025_09_30_031349_create_customers_table.php b/database/migrations/2025_09_30_031349_create_customers_table.php index 4ff850a..d7ba3ba 100644 --- a/database/migrations/2025_09_30_031349_create_customers_table.php +++ b/database/migrations/2025_09_30_031349_create_customers_table.php @@ -17,7 +17,7 @@ public function up(): void $table->foreignId('user_id')->nullable()->constrained()->cascadeOnDelete(); $table->string('name', 50); $table->string('phone_number', 20)->nullable(); - $table->enum('gender', [Gender::values()])->comment(Gender::comment()); + $table->enum('gender', Gender::values())->comment(Gender::comment()); $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->nullable()->useCurrentOnUpdate(); $table->softDeletes(); diff --git a/database/migrations/2025_10_01_112147_create_perfumes_table.php b/database/migrations/2025_10_01_112147_create_perfumes_table.php index 9d56ecb..e264824 100644 --- a/database/migrations/2025_10_01_112147_create_perfumes_table.php +++ b/database/migrations/2025_10_01_112147_create_perfumes_table.php @@ -18,7 +18,7 @@ public function up(): void $table->string('name', 50); $table->string('slug', 70)->unique(); $table->string('sku', 20)->unique(); - $table->enum('concentration', [Concentration::values()])->default(Concentration::EXTRAIT_DE_PERFUME)->comment(Concentration::comment()); + $table->enum('concentration', Concentration::values())->default(Concentration::EXTRAIT_DE_PERFUME)->comment(Concentration::comment()); $table->unsignedInteger('cost_price')->default(0); $table->unsignedInteger('sale_price')->default(0); $table->unsignedInteger('point_per_ml'); diff --git a/database/migrations/2025_10_03_025736_create_articles_table.php b/database/migrations/2025_10_03_025736_create_articles_table.php index 0e013b6..008f4af 100644 --- a/database/migrations/2025_10_03_025736_create_articles_table.php +++ b/database/migrations/2025_10_03_025736_create_articles_table.php @@ -19,7 +19,7 @@ public function up(): void $table->string('slug')->unique(); $table->text('excerpt'); $table->text('content'); - $table->enum('status', [ArticleStatus::values()])->default(ArticleStatus::PUBLISHED)->comment(ArticleStatus::comment()); + $table->enum('status', ArticleStatus::values())->default(ArticleStatus::PUBLISHED)->comment(ArticleStatus::comment()); $table->timestamp('published_at')->nullable(); $table->unsignedInteger('views')->default(0); $table->timestamp('created_at')->useCurrent(); diff --git a/database/migrations/2025_10_04_143515_create_payrolls_table.php b/database/migrations/2025_10_04_143515_create_payrolls_table.php index 26d2971..da6f978 100644 --- a/database/migrations/2025_10_04_143515_create_payrolls_table.php +++ b/database/migrations/2025_10_04_143515_create_payrolls_table.php @@ -20,7 +20,7 @@ public function up(): void $table->unsignedInteger('bonus'); $table->unsignedInteger('deduction'); $table->unsignedInteger('total_salary'); - $table->enum('is_paid', [IsPaid::values()])->default(IsPaid::NOT_PAID)->comment(IsPaid::comment()); + $table->enum('is_paid', IsPaid::values())->default(IsPaid::NOT_PAID)->comment(IsPaid::comment()); $table->dateTime('paid_at')->nullable(); $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate(); diff --git a/database/migrations/2025_10_04_143521_create_payroll_adjustments_table.php b/database/migrations/2025_10_04_143521_create_payroll_adjustments_table.php index b874b77..e44a85f 100644 --- a/database/migrations/2025_10_04_143521_create_payroll_adjustments_table.php +++ b/database/migrations/2025_10_04_143521_create_payroll_adjustments_table.php @@ -15,7 +15,7 @@ public function up(): void Schema::create('payroll_adjustments', function (Blueprint $table) { $table->id(); $table->foreignId('payroll_id')->constrained()->cascadeOnDelete(); - $table->enum('type', [SalaryAdjustmentType::values()])->comment(SalaryAdjustmentType::comment()); + $table->enum('type', SalaryAdjustmentType::values())->comment(SalaryAdjustmentType::comment()); $table->string('description', 100); $table->unsignedInteger('amount'); $table->timestamp('created_at')->useCurrent(); diff --git a/database/migrations/2025_10_06_135045_create_orders_table.php b/database/migrations/2025_10_06_135045_create_orders_table.php index e3a6b23..fbd72e9 100644 --- a/database/migrations/2025_10_06_135045_create_orders_table.php +++ b/database/migrations/2025_10_06_135045_create_orders_table.php @@ -24,8 +24,8 @@ public function up(): void $table->unsignedInteger('subtotal'); $table->unsignedInteger('discount'); $table->unsignedInteger('total'); - $table->enum('channel', [OrderChannel::values()])->default(OrderChannel::OUTLET)->comment(OrderChannel::comment()); - $table->enum('status', [OrderStatus::values()])->default(OrderStatus::PENDING)->comment(OrderStatus::comment()); + $table->enum('channel', OrderChannel::values())->default(OrderChannel::OUTLET)->comment(OrderChannel::comment()); + $table->enum('status', OrderStatus::values())->default(OrderStatus::PENDING)->comment(OrderStatus::comment()); $table->dateTime('ordered_at'); $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->nullable()->useCurrentOnUpdate(); diff --git a/database/migrations/2025_10_06_140341_create_payments_table.php b/database/migrations/2025_10_06_140341_create_payments_table.php index 461e86c..2a3f21c 100644 --- a/database/migrations/2025_10_06_140341_create_payments_table.php +++ b/database/migrations/2025_10_06_140341_create_payments_table.php @@ -17,10 +17,10 @@ public function up(): void $table->id(); $table->foreignId('order_id')->constrained()->cascadeOnDelete(); $table->foreignId('user_id')->constrained()->cascadeOnDelete(); - $table->enum('method', [PaymentMethod::values()])->default(PaymentMethod::CASH)->comment(PaymentMethod::comment()); + $table->enum('method', PaymentMethod::values())->default(PaymentMethod::CASH)->comment(PaymentMethod::comment()); $table->unsignedInteger('amount'); $table->timestamp('paid_at')->useCurrent(); - $table->enum('status', [PaymentStatus::values()])->default(PaymentStatus::PENDING)->comment(PaymentStatus::comment()); + $table->enum('status', PaymentStatus::values())->default(PaymentStatus::PENDING)->comment(PaymentStatus::comment()); $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->nullable()->useCurrentOnUpdate(); $table->softDeletes(); diff --git a/database/migrations/2025_10_29_013939_create_price_requests_table.php b/database/migrations/2025_10_29_013939_create_price_requests_table.php index 5435a39..7dcf19c 100644 --- a/database/migrations/2025_10_29_013939_create_price_requests_table.php +++ b/database/migrations/2025_10_29_013939_create_price_requests_table.php @@ -16,7 +16,7 @@ public function up(): void $table->id(); $table->foreignId('user_id')->constrained()->cascadeOnDelete(); $table->string('module', 20); - $table->enum('status', [PriceRequestStatus::values()])->default(PriceRequestStatus::PENDING)->comment(PriceRequestStatus::comment()); + $table->enum('status', PriceRequestStatus::values())->default(PriceRequestStatus::PENDING)->comment(PriceRequestStatus::comment()); $table->timestamp('finalized_at')->nullable(); $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate(); diff --git a/database/migrations/2025_11_12_190102_create_point_records_table.php b/database/migrations/2025_11_12_190102_create_point_records_table.php index 606c039..ad6799d 100644 --- a/database/migrations/2025_11_12_190102_create_point_records_table.php +++ b/database/migrations/2025_11_12_190102_create_point_records_table.php @@ -16,7 +16,7 @@ public function up(): void $table->id(); $table->foreignId('user_id')->constrained()->cascadeOnDelete(); $table->unsignedBigInteger('change'); - $table->enum('type', [PointRecordType::values()])->comment(PointRecordType::comment()); + $table->enum('type', PointRecordType::values())->comment(PointRecordType::comment()); $table->string('description', 50); $table->boolean('is_addition'); $table->timestamp('created_at')->useCurrent(); diff --git a/database/migrations/2025_11_23_193832_create_stock_opname_table.php b/database/migrations/2025_11_23_193832_create_stock_opname_table.php index d6a76d0..5cb92ac 100644 --- a/database/migrations/2025_11_23_193832_create_stock_opname_table.php +++ b/database/migrations/2025_11_23_193832_create_stock_opname_table.php @@ -16,7 +16,7 @@ public function up(): void $table->id(); $table->foreignId('outlet_id')->constrained()->cascadeOnDelete(); $table->string('period_month', 7); - $table->enum('status', [StockOpnameStatus::values()])->default(StockOpnameStatus::DRAFT)->comment(StockOpnameStatus::comment()); + $table->enum('status', StockOpnameStatus::values())->default(StockOpnameStatus::DRAFT)->comment(StockOpnameStatus::comment()); $table->text('note')->nullable(); $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();