Skip to content

Commit

Permalink
Merge pull request #1 from justbetter/feature/magento-existance
Browse files Browse the repository at this point in the history
Magento existence
  • Loading branch information
VincentBean committed Oct 11, 2022
2 parents 6cf6d28 + c9a10fe commit 5a06d46
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Nova/MagentoPrices.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Bolechen\NovaActivitylog\Resources\Activitylog;
use Illuminate\Http\Request;
use JustBetter\MagentoPrices\Models\MagentoPrice;
use JustBetter\MagentoProducts\Models\MagentoProduct;
use JustBetter\NovaErrorLogger\Nova\Error;
use Laravel\Nova\Fields\Boolean;
use Laravel\Nova\Fields\Code;
Expand Down Expand Up @@ -39,6 +40,13 @@ public function fields(NovaRequest $request): array
->help(__('Disable if this product stock should not be synced'))
->sortable(),

Boolean::make(__('Exists in Magento'), function (MagentoPrice $price) {
$product = MagentoProduct::findBySku($price->sku);

return $product === null ? false : $product->exists_in_magento;
})
->showOnIndex(false),

Text::make(__('SKU'), 'sku')
->readonly()
->sortable(),
Expand Down

0 comments on commit 5a06d46

Please sign in to comment.