Skip to content

Commit 053fd9e

Browse files
authored
Merge pull request #107 from tastyigniter/4.x
Release v4.1.2
2 parents 27887c9 + aad6003 commit 053fd9e

24 files changed

+73
-32
lines changed

resources/lang/en/default.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,5 +633,8 @@
633633
'text_delivery_order_count' => 'Number of Delivery Orders',
634634
'text_canceled_order_total' => 'Total Canceled Orders',
635635
'text_canceled_order_count' => 'Number of Canceled Orders',
636+
'text_onboarding_menus' => 'Build your menu',
637+
638+
'help_onboarding_menus' => 'Add your dishes, organize them into categories, and set prices. This is what your hungry customers will browse and order from.',
636639
],
637640
];

resources/models/inventory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
'stockable_type_name' => [
2828
'label' => 'lang:igniter.cart::default.stocks.column_stockable_type',
2929
'type' => 'text',
30-
'searchable' => true,
30+
'select' => 'stockable_type',
31+
'searchable' => false,
3132
],
3233
'stockable_name' => [
3334
'label' => 'lang:igniter.cart::default.stocks.column_stockable_name',

src/Cart.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616

1717
class Cart
1818
{
19-
public const string DEFAULT_INSTANCE = 'default';
20-
2119
/**
2220
* Holds the current cart instance.
2321
*/
24-
protected string $instance = self::DEFAULT_INSTANCE;
22+
protected string $instance = 'default';
2523

2624
/**
2725
* @var ?CartConditions Instance of the cart condition.
@@ -61,7 +59,7 @@ public function instance(?string $instance = null): static
6159
*/
6260
public function currentInstance(): string
6361
{
64-
return str_replace('cart.', '', $this->instance);
62+
return $this->instance;
6563
}
6664

6765
/**
@@ -560,13 +558,16 @@ protected function storedCartWithIdentifierExists($identifier)
560558
{
561559
return $this->createModel()
562560
->where('identifier', $identifier)
563-
->where('instance', $this->currentInstance())->exists();
561+
->where('instance', $this->currentInstance())
562+
->exists();
564563
}
565564

566565
protected function getStoredCartByIdentifier($identifier)
567566
{
568567
return $this->createModel()
569-
->where('identifier', $identifier)->first();
568+
->where('identifier', $identifier)
569+
->where('instance', $this->currentInstance())
570+
->first();
570571
}
571572

572573
/**

src/CartItem.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,9 @@ protected function makeCartItemConditions($conditions)
305305

306306
/**
307307
* Get the instance as an array.
308-
*
309-
* @return array
310308
*/
311309
#[Override]
312-
public function toArray()
310+
public function toArray(): array
313311
{
314312
return [
315313
'rowId' => $this->rowId,

src/CartItemOption.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,9 @@ protected function makeCartOptionValues($values)
9191

9292
/**
9393
* Get the instance as an array.
94-
*
95-
* @return array
9694
*/
9795
#[Override]
98-
public function toArray()
96+
public function toArray(): array
9997
{
10098
return [
10199
'id' => $this->id,

src/CartItemOptionValue.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,9 @@ public static function fromArray(array $attributes): self
121121

122122
/**
123123
* Get the instance as an array.
124-
*
125-
* @return array
126124
*/
127125
#[Override]
128-
public function toArray()
126+
public function toArray(): array
129127
{
130128
return [
131129
'id' => $this->id,

src/Classes/CartManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public function validateMenuItem(Menu $menuItem): void
368368
sprintf(
369369
lang('igniter.cart::default.alert_menu_not_within_mealtimes'),
370370
$menuItem->menu_name,
371-
strtolower((string) $menuItem->mealtimes->filter(fn(Mealtime $mealtime): bool => $mealtime->isEnabled())
371+
strtolower((string)$menuItem->mealtimes->filter(fn(Mealtime $mealtime): bool => $mealtime->isEnabled())
372372
->pluck('description')
373373
->join(', ')),
374374
),

src/Database/Factories/StockFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class StockFactory extends Factory
1414
protected $model = Stock::class;
1515

1616
#[Override]
17-
public function definition()
17+
public function definition(): array
1818
{
1919
return [
2020
'location_id' => Location::factory(),

src/Database/Factories/StockHistoryFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class StockHistoryFactory extends Factory
1616
protected $model = StockHistory::class;
1717

1818
#[Override]
19-
public function definition()
19+
public function definition(): array
2020
{
2121
return [
2222
'stock_id' => Stock::factory(),

src/Extension.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,4 +472,18 @@ protected function registerMiddlewares(): void
472472
$this->app['router']->pushMiddlewareToGroup('igniter', CartMiddleware::class);
473473
}
474474
}
475+
476+
public function registerOnboardingSteps(): array
477+
{
478+
return [
479+
'igniter.cart::menus' => [
480+
'label' => 'igniter.cart::default.dashboard.text_onboarding_menus',
481+
'description' => 'igniter.cart::default.dashboard.help_onboarding_menus',
482+
'icon' => 'fa-cutlery',
483+
'url' => admin_url('menus'),
484+
'priority' => 30,
485+
'complete' => Menu::onboardingIsComplete(...),
486+
],
487+
];
488+
}
475489
}

0 commit comments

Comments
 (0)