- copy .env.example to .env
- add auth.json for Laravel Nova
- setup local mysql db called
novatest
- setup local domain (nova.test) -
cd public
andvalet link nova
- add both .env values for Algolia
- run
composer install
- run
php artisan migrate:fresh --seed
- Login to nova http://nova.test/nova
Username: [email protected] Password: password
We have three main models related to the problem:
- Product
- Ingredient
- Merchant
And one pivot table for IngredientProduct
The pivot table has three columns: ingredient_id
, product_id
, merchant_id
The merchant_id
is needed for an additional column order_column
that will be needed for custom sorting later
When attaching a product to an ingredient, we need to include the selected merchant from the filter to algolia query, so we only get products from the selected merchant.
- Visit http://nova.test/nova/resources/ingredients/1
- Select a merchant from the filter e.g.
Superstore
- Click
Attach Product
- The searchable product field should only show products from the selected merchant
- Pass merchant_id from the filter to the attach screen through a query parameter and change the scoutQuery
- Perfect would be to pass the selected merchant and also replace the search dropdown/select with a custom component, so we could implement Algolias Vue InstantSearch and add all the facet filters in the custom component.