partner_stores, store_inventories, store_purchases, store_sales tables. Promotes qr_code_batches.target_store_id and qr_codes.assigned_to_store_id to real FKs. StoreOperations service handles wholesale issuance (generates fresh batch -> codes go allocated to store -> inventory tops up -> StorePurchase recorded) and resident sales (codes flip allocated -> active to a household, commission computed at the store's rate). Admin endpoints: store CRUD, issue-inventory, record-sale. 160 feature tests passing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
30 lines
843 B
PHP
30 lines
843 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\PartnerStore;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\PartnerStore>
|
|
*/
|
|
class PartnerStoreFactory extends Factory
|
|
{
|
|
protected $model = PartnerStore::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'uuid' => (string) Str::uuid(),
|
|
'owner_user_id' => User::factory()->state(['role' => 'store_partner'])->create()->id,
|
|
'business_name' => fake()->company().' Store',
|
|
'business_permit_number' => 'BP-'.strtoupper(Str::random(8)),
|
|
'address_line' => fake()->streetAddress(),
|
|
'commission_rate_percent' => 10,
|
|
'status' => 'active',
|
|
];
|
|
}
|
|
}
|