Work on ordertest, splitting address lines, and shipping entry stuff
This commit is contained in:
parent
2c0fbfde5b
commit
487ea48c14
@ -31,8 +31,10 @@ public static function form(Form $form): Form
|
|||||||
Section::make([
|
Section::make([
|
||||||
TextInput::make('company_name'),
|
TextInput::make('company_name'),
|
||||||
TextInput::make('phone'),
|
TextInput::make('phone'),
|
||||||
TextInput::make('shipping_address'),
|
TextInput::make('shipping_address_line_1'),
|
||||||
TextInput::make('billing_address'),
|
TextInput::make('shipping_address_line_2'),
|
||||||
|
TextInput::make('billing_address_line_1'),
|
||||||
|
TextInput::make('billing_address_line_2'),
|
||||||
])->columns(2),
|
])->columns(2),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -41,8 +43,10 @@ public static function table(Table $table): Table
|
|||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
->columns([
|
->columns([
|
||||||
TextColumn::make('company_name'),
|
TextColumn::make('company_name')
|
||||||
TextColumn::make('shipping_address'),
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
// TextColumn::make('shipping_address'),
|
||||||
TextColumn::make('phone'),
|
TextColumn::make('phone'),
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
|
@ -32,8 +32,9 @@ public function table(Table $table): Table
|
|||||||
->label('Username'),
|
->label('Username'),
|
||||||
Tables\Columns\TextColumn::make('account_password')
|
Tables\Columns\TextColumn::make('account_password')
|
||||||
->label('Password'),
|
->label('Password'),
|
||||||
Tables\Columns\TextColumn::make('info_needed')
|
Tables\Columns\TextColumn::make('info_needed'),
|
||||||
->extraHeaderAttributes(['class' => 'w-full']),
|
// ->extraHeaderAttributes(['class' => 'w-full']),
|
||||||
|
Tables\Columns\TextColumn::make('notes'),
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
//
|
//
|
||||||
@ -42,8 +43,8 @@ public function table(Table $table): Table
|
|||||||
Tables\Actions\CreateAction::make(),
|
Tables\Actions\CreateAction::make(),
|
||||||
])
|
])
|
||||||
->actions([
|
->actions([
|
||||||
Tables\Actions\EditAction::make(),
|
// Tables\Actions\EditAction::make(),
|
||||||
Tables\Actions\DeleteAction::make(),
|
// Tables\Actions\DeleteAction::make(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,12 +121,6 @@ public static function table(Table $table): Table
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
], layout: Tables\Enums\FiltersLayout::AboveContent)
|
], layout: Tables\Enums\FiltersLayout::AboveContent)
|
||||||
->hiddenFilterIndicators()
|
|
||||||
->actions([// Action::make('generateReport')
|
|
||||||
// ->label('Make Report')
|
|
||||||
// ->icon('lucide-sticky-note'),
|
|
||||||
]);
|
|
||||||
|
|
||||||
->hiddenFilterIndicators()
|
->hiddenFilterIndicators()
|
||||||
|
|
||||||
->actions([])
|
->actions([])
|
||||||
|
@ -89,6 +89,7 @@ public static function form(Form $form): Form
|
|||||||
->schema([
|
->schema([
|
||||||
ToggleButtons::make('status')
|
ToggleButtons::make('status')
|
||||||
->required()
|
->required()
|
||||||
|
->default(OrderStatus::DRAFT->value)
|
||||||
->options(OrderStatus::class)
|
->options(OrderStatus::class)
|
||||||
->inline(),
|
->inline(),
|
||||||
|
|
||||||
@ -99,9 +100,11 @@ public static function form(Form $form): Form
|
|||||||
|
|
||||||
ToggleButtons::make('printed')
|
ToggleButtons::make('printed')
|
||||||
->boolean()
|
->boolean()
|
||||||
|
->default(false)
|
||||||
->inline(),
|
->inline(),
|
||||||
ToggleButtons::make('pre_production')
|
ToggleButtons::make('pre_production')
|
||||||
->label('Pre-production')
|
->label('Pre-production')
|
||||||
|
->default(false)
|
||||||
->boolean()
|
->boolean()
|
||||||
->inline()
|
->inline()
|
||||||
->colors([
|
->colors([
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
use App\Models\ProductService;
|
use App\Models\ProductService;
|
||||||
use App\Models\ProductSize;
|
use App\Models\ProductSize;
|
||||||
use App\Models\ServiceFile;
|
use App\Models\ServiceFile;
|
||||||
|
use App\Models\ServiceType;
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
class CreateOrder extends CreateRecord
|
class CreateOrder extends CreateRecord
|
||||||
@ -64,9 +65,8 @@ protected function handleRecordCreation(array $data): Order
|
|||||||
'setup_number' => $service['serviceFileSetupNumber'] ?? null,
|
'setup_number' => $service['serviceFileSetupNumber'] ?? null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//todo: change servce_type
|
|
||||||
ProductService::create([
|
ProductService::create([
|
||||||
// 'service_type' => strtoupper($service['service_type']) ?? null,
|
'service_type_id' => ServiceType::findOrFail($service['serviceType'])->id ?? null,
|
||||||
'placement' => strtoupper($service['placement']) ?? null,
|
'placement' => strtoupper($service['placement']) ?? null,
|
||||||
'notes' => strtoupper($service['notes']) ?? null,
|
'notes' => strtoupper($service['notes']) ?? null,
|
||||||
'amount' => $service['amount'] ?? null,
|
'amount' => $service['amount'] ?? null,
|
||||||
@ -77,8 +77,6 @@ protected function handleRecordCreation(array $data): Order
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
dd($data);
|
|
||||||
|
|
||||||
return $order;
|
return $order;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
use App\Models\ProductService;
|
use App\Models\ProductService;
|
||||||
use App\Models\ProductSize;
|
use App\Models\ProductSize;
|
||||||
use App\Models\ServiceFile;
|
use App\Models\ServiceFile;
|
||||||
|
use App\Models\ServiceType;
|
||||||
use Filament\Actions;
|
use Filament\Actions;
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Filament\Resources\Pages\EditRecord;
|
use Filament\Resources\Pages\EditRecord;
|
||||||
@ -46,15 +47,13 @@ protected function mutateFormDataBeforeFill(array $data): array
|
|||||||
'amount' => $service->amount ?? '',
|
'amount' => $service->amount ?? '',
|
||||||
'amount_price' => $service->amount_price ?? '',
|
'amount_price' => $service->amount_price ?? '',
|
||||||
'notes' => $service->notes ?? '',
|
'notes' => $service->notes ?? '',
|
||||||
|
'serviceType' => $service->serviceType->id ?? '',
|
||||||
'serviceFileName' => $service->serviceFile->name ?? '',
|
'serviceFileName' => $service->serviceFile->name ?? '',
|
||||||
'serviceFileWidth' => $service->serviceFile->width ?? '',
|
'serviceFileWidth' => $service->serviceFile->width ?? '',
|
||||||
'serviceFileHeight' => $service->serviceFile->height ?? '',
|
'serviceFileHeight' => $service->serviceFile->height ?? '',
|
||||||
'serviceFileCode' => $service->serviceFile->code ?? '',
|
'serviceFileCode' => $service->serviceFile->code ?? '',
|
||||||
'serviceFileSetupNumber' => $service->serviceFile->setup_number ?? '',
|
'serviceFileSetupNumber' => $service->serviceFile->setup_number ?? '',
|
||||||
];
|
];
|
||||||
|
|
||||||
//todo ServiceType
|
|
||||||
// $service->serviceType()->associate(ServiceType::)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (OrderAttributes::cases() as $case) {
|
foreach (OrderAttributes::cases() as $case) {
|
||||||
@ -128,7 +127,7 @@ public function handleRecordUpdate(Model $record, array $data): Model
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
ProductService::create([
|
ProductService::create([
|
||||||
'service_type' => strtoupper($service['service_type']) ?? null,
|
'service_type_id' => ServiceType::findOrFail($service['serviceType'])->id ?? null,
|
||||||
'placement' => strtoupper($service['placement']) ?? null,
|
'placement' => strtoupper($service['placement']) ?? null,
|
||||||
'notes' => strtoupper($service['notes']) ?? null,
|
'notes' => strtoupper($service['notes']) ?? null,
|
||||||
'amount' => $service['amount'] ?? null,
|
'amount' => $service['amount'] ?? null,
|
||||||
|
@ -31,7 +31,19 @@ public static function table(Table $table): Table
|
|||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
->columns([
|
->columns([
|
||||||
//
|
Tables\Columns\TextColumn::make('customer.company_name')
|
||||||
|
->searchable(),
|
||||||
|
Tables\Columns\TextColumn::make('shipping_type')
|
||||||
|
->label('Type')
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('courier'),
|
||||||
|
// Tables\Columns\TextColumn::make('contact'),
|
||||||
|
Tables\Columns\TextColumn::make('account_title'),
|
||||||
|
// Tables\Columns\TextColumn::make('account_username'),
|
||||||
|
// Tables\Columns\TextColumn::make('account_password'),
|
||||||
|
Tables\Columns\TextColumn::make('info_needed'),
|
||||||
|
Tables\Columns\TextColumn::make('notify'),
|
||||||
|
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
//
|
//
|
||||||
@ -40,10 +52,14 @@ public static function table(Table $table): Table
|
|||||||
Tables\Actions\EditAction::make(),
|
Tables\Actions\EditAction::make(),
|
||||||
])
|
])
|
||||||
->bulkActions([
|
->bulkActions([
|
||||||
Tables\Actions\BulkActionGroup::make([
|
// Tables\Actions\BulkActionGroup::make([
|
||||||
Tables\Actions\DeleteBulkAction::make(),
|
// Tables\Actions\DeleteBulkAction::make(),
|
||||||
]),
|
// ]),
|
||||||
]);
|
]);
|
||||||
|
// ->defaultGroup(
|
||||||
|
// Group::make('customer.company_name')
|
||||||
|
// ->titlePrefixedWithLabel(false)
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getRelations(): array
|
public static function getRelations(): array
|
||||||
|
@ -16,8 +16,10 @@ class Customer extends Model
|
|||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'company_name',
|
'company_name',
|
||||||
'internal_name',
|
'internal_name',
|
||||||
'shipping_address',
|
'shipping_address_line_1',
|
||||||
'billing_address',
|
'shipping_address_line_2',
|
||||||
|
'billing_address_line_1',
|
||||||
|
'billing_address_line_2',
|
||||||
'phone',
|
'phone',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ class ProductService extends Model
|
|||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'order_id',
|
'order_id',
|
||||||
'service_file_id',
|
'service_file_id',
|
||||||
|
'service_type_id',
|
||||||
'placement',
|
'placement',
|
||||||
'setup_amount',
|
'setup_amount',
|
||||||
'amount',
|
'amount',
|
||||||
|
4
composer.lock
generated
4
composer.lock
generated
@ -11355,12 +11355,12 @@
|
|||||||
],
|
],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": [],
|
"stability-flags": {},
|
||||||
"prefer-stable": true,
|
"prefer-stable": true,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": {
|
"platform": {
|
||||||
"php": "^8.2"
|
"php": "^8.2"
|
||||||
},
|
},
|
||||||
"platform-dev": [],
|
"platform-dev": {},
|
||||||
"plugin-api-version": "2.6.0"
|
"plugin-api-version": "2.6.0"
|
||||||
}
|
}
|
||||||
|
@ -14,16 +14,19 @@ public function definition()
|
|||||||
{
|
{
|
||||||
$company_name = $this->faker->company();
|
$company_name = $this->faker->company();
|
||||||
$internal_name = explode(',', $company_name);
|
$internal_name = explode(',', $company_name);
|
||||||
$address = $this->faker->address();
|
$address = $this->faker->streetAddress();
|
||||||
|
$city = 'Vancouver, Canada';
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'company_name' => $company_name,
|
'company_name' => $company_name,
|
||||||
'internal_name' => strtolower($internal_name[0]),
|
'internal_name' => strtolower($internal_name[0]),
|
||||||
'shipping_address' => $address,
|
'shipping_address_line_1' => $address,
|
||||||
'billing_address' => $address,
|
'shipping_address_line_2' => $city,
|
||||||
'phone' => $this->faker->phoneNumber(),
|
'billing_address_line_1' => $address,
|
||||||
'created_at' => Carbon::now(),
|
'billing_address_line_2' => $city,
|
||||||
'updated_at' => Carbon::now(),
|
'phone' => $this->faker->phoneNumber(),
|
||||||
|
'created_at' => Carbon::now(),
|
||||||
|
'updated_at' => Carbon::now(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,10 @@ public function up()
|
|||||||
|
|
||||||
$table->string('company_name');
|
$table->string('company_name');
|
||||||
$table->string('internal_name');
|
$table->string('internal_name');
|
||||||
$table->string('shipping_address');
|
$table->string('shipping_address_line_1');
|
||||||
$table->string('billing_address');
|
$table->string('shipping_address_line_2');
|
||||||
|
$table->string('billing_address_line_1');
|
||||||
|
$table->string('billing_address_line_2');
|
||||||
$table->string('phone');
|
$table->string('phone');
|
||||||
|
|
||||||
$table->softDeletes();
|
$table->softDeletes();
|
||||||
|
@ -7,7 +7,7 @@ parameters:
|
|||||||
- app/
|
- app/
|
||||||
|
|
||||||
# Level 9 is the highest level
|
# Level 9 is the highest level
|
||||||
level: 9
|
level: 1
|
||||||
|
|
||||||
# ignoreErrors:
|
# ignoreErrors:
|
||||||
# - '#PHPDoc tag @var#'
|
# - '#PHPDoc tag @var#'
|
||||||
@ -15,4 +15,4 @@ parameters:
|
|||||||
# excludePaths:
|
# excludePaths:
|
||||||
# - ./*/*/FileToBeExcluded.php
|
# - ./*/*/FileToBeExcluded.php
|
||||||
#
|
#
|
||||||
# checkMissingIterableValueType: false
|
# checkMissingIterableValueType: false
|
||||||
|
BIN
public/invoice-tn-in-24-0054.pdf
Normal file
BIN
public/invoice-tn-in-24-0054.pdf
Normal file
Binary file not shown.
@ -29,7 +29,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{$invoice->customer->company_name}} <br>
|
{{$invoice->customer->company_name}} <br>
|
||||||
{{$invoice->customer->billing_address}} <br>
|
{{$invoice->customer->billing_address_line_1}} <br>
|
||||||
|
{{$invoice->customer->billing_address_line_2}} <br>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Feature;
|
|
||||||
|
|
||||||
use App\Filament\Resources\OrderResource\Pages\ListOrders;
|
|
||||||
use App\Models\Customer;
|
|
||||||
use App\Models\Order;
|
|
||||||
use App\Models\OrderProduct;
|
|
||||||
use App\Models\ProductService;
|
|
||||||
use App\Models\ServiceFile;
|
|
||||||
|
|
||||||
use function Pest\Livewire\livewire;
|
|
||||||
|
|
||||||
it('can list posts', function () {
|
|
||||||
$customer = Customer::factory()->create();
|
|
||||||
$orders = Order::factory()->for($customer)->count(2)->create();
|
|
||||||
|
|
||||||
livewire(ListOrders::class)
|
|
||||||
->assertCanSeeTableRecords($orders);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can create a post', function () {
|
|
||||||
$customer = Customer::factory()->create();
|
|
||||||
$formData = Order::factory()->for($customer)->create();
|
|
||||||
|
|
||||||
$formData['order_products'] = OrderProduct::factory()->count(2)->create();
|
|
||||||
|
|
||||||
$formData['order_products'][0]['xs'] = 4;
|
|
||||||
$formData['order_products'][1]['s'] = 3;
|
|
||||||
|
|
||||||
$serviceFile1 = ServiceFile::factory()->create();
|
|
||||||
$serviceFile2 = ServiceFile::factory()->create();
|
|
||||||
|
|
||||||
$formData['services'][0] = ProductService::factory()->for($serviceFile1)->create();
|
|
||||||
$formData['services'][1] = ProductService::factory()->for($serviceFile2)->create();
|
|
||||||
|
|
||||||
dd($formData);
|
|
||||||
});
|
|
110
tests/Feature/OrdersTest.php
Normal file
110
tests/Feature/OrdersTest.php
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use App\Enums\OrderAttributes;
|
||||||
|
use App\Enums\OrderStatus;
|
||||||
|
use App\Enums\OrderType;
|
||||||
|
use App\Filament\Resources\OrderResource\Pages\CreateOrder;
|
||||||
|
use App\Models\Contact;
|
||||||
|
use App\Models\Customer;
|
||||||
|
use App\Models\Order;
|
||||||
|
use App\Models\ServiceType;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
use function Pest\Livewire\livewire;
|
||||||
|
|
||||||
|
it('can create an order and save it to the database', function () {
|
||||||
|
$type = fake()->randomElement(OrderType::cases());
|
||||||
|
$status = fake()->randomElement(OrderStatus::cases());
|
||||||
|
$customer = Customer::factory()->create();
|
||||||
|
$contact = Contact::factory()->for($customer)->create();
|
||||||
|
$attributes = array_map(fn ($case) => $case->value, OrderAttributes::cases());
|
||||||
|
|
||||||
|
$serviceTypes = ServiceType::factory()->count(2)->create();
|
||||||
|
|
||||||
|
$user = User::factory()->create();
|
||||||
|
$this->actingAs($user);
|
||||||
|
|
||||||
|
$formData = [
|
||||||
|
'order_type' => $type->value,
|
||||||
|
'customer_id' => $customer->id,
|
||||||
|
'contact_id' => $contact->id,
|
||||||
|
'customer_po' => 'Customer PO name here',
|
||||||
|
'order_date' => today(),
|
||||||
|
'due_date' => today()->addDays(10),
|
||||||
|
'notes' => 'Notes go here! Here\'s the notes!',
|
||||||
|
'pre_production' => '1',
|
||||||
|
'printed' => '1',
|
||||||
|
'status' => $status->value,
|
||||||
|
'order_attributes' => $attributes,
|
||||||
|
'order_products' => [
|
||||||
|
[
|
||||||
|
'sku' => 'sku 1',
|
||||||
|
'product_name' => 'test',
|
||||||
|
'color' => 'black',
|
||||||
|
'xs' => '1',
|
||||||
|
's' => '2',
|
||||||
|
'm' => '3',
|
||||||
|
'l' => '4',
|
||||||
|
'xl' => '5',
|
||||||
|
'2xl' => '6',
|
||||||
|
'3xl' => '7',
|
||||||
|
'osfa' => '8',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'sku' => 'sku 2',
|
||||||
|
'product_name' => 'alsotest',
|
||||||
|
'color' => 'white',
|
||||||
|
'xs' => '9',
|
||||||
|
's' => '10',
|
||||||
|
'm' => '11',
|
||||||
|
'l' => '12',
|
||||||
|
'xl' => '13',
|
||||||
|
'2xl' => '14',
|
||||||
|
'3xl' => '15',
|
||||||
|
'osfa' => '16',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'services' => [
|
||||||
|
[
|
||||||
|
'serviceType' => $serviceTypes[0]->id,
|
||||||
|
'placement' => 'c/f',
|
||||||
|
'serviceFileName' => 'logo name 1',
|
||||||
|
'serviceFileSetupNumber' => '1',
|
||||||
|
'serviceFileWidth' => '1',
|
||||||
|
'serviceFileHeight' => '2',
|
||||||
|
'amount' => '3',
|
||||||
|
'amount_price' => '4',
|
||||||
|
'serviceFileCode' => 'A1234',
|
||||||
|
'notes' => 'Here\'s some notes, all handwritten by me.',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'serviceType' => $serviceTypes[1]->id,
|
||||||
|
'placement' => 'f/b',
|
||||||
|
'serviceFileName' => 'logo name 2',
|
||||||
|
'serviceFileSetupNumber' => '5',
|
||||||
|
'serviceFileWidth' => '6',
|
||||||
|
'serviceFileHeight' => '7',
|
||||||
|
'amount' => '8',
|
||||||
|
'amount_price' => '9',
|
||||||
|
'serviceFileCode' => 'B5678',
|
||||||
|
'notes' => 'Here\'s even more notes, still handwritten by me.',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
livewire(CreateOrder::class)
|
||||||
|
->set('data.order_products', [])
|
||||||
|
->set('data.services', [])
|
||||||
|
->fillForm($formData)
|
||||||
|
->call('create')
|
||||||
|
->assertHasNoErrors();
|
||||||
|
|
||||||
|
$order = Order::first();
|
||||||
|
|
||||||
|
$this->assertNotNull($order);
|
||||||
|
|
||||||
|
$this->assertSame($order->customer_id, $formData['customer_id']);
|
||||||
|
|
||||||
|
});
|
@ -1,38 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Feature;
|
|
||||||
|
|
||||||
use App\Filament\Resources\OrderResource\Pages\ListOrders;
|
|
||||||
use App\Models\Customer;
|
|
||||||
use App\Models\Order;
|
|
||||||
use App\Models\OrderProduct;
|
|
||||||
use App\Models\ProductService;
|
|
||||||
use App\Models\ServiceFile;
|
|
||||||
|
|
||||||
use function Pest\Livewire\livewire;
|
|
||||||
|
|
||||||
it('can list posts', function () {
|
|
||||||
$customer = Customer::factory()->create();
|
|
||||||
$orders = Order::factory()->for($customer)->count(2)->create();
|
|
||||||
|
|
||||||
livewire(ListOrders::class)
|
|
||||||
->assertCanSeeTableRecords($orders);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can create a post', function () {
|
|
||||||
$customer = Customer::factory()->create();
|
|
||||||
$formData = Order::factory()->for($customer)->create();
|
|
||||||
|
|
||||||
$formData['order_products'] = OrderProduct::factory()->count(2)->create();
|
|
||||||
|
|
||||||
$formData['order_products'][0]['xs'] = 4;
|
|
||||||
$formData['order_products'][1]['s'] = 3;
|
|
||||||
|
|
||||||
$serviceFile1 = ServiceFile::factory()->create();
|
|
||||||
$serviceFile2 = ServiceFile::factory()->create();
|
|
||||||
|
|
||||||
$formData['services'][0] = ProductService::factory()->for($serviceFile1)->create();
|
|
||||||
$formData['services'][1] = ProductService::factory()->for($serviceFile2)->create();
|
|
||||||
|
|
||||||
dd($formData);
|
|
||||||
});
|
|
Loading…
x
Reference in New Issue
Block a user