├── .editorconfig ├── .github ├── CONTRIBUTING.md ├── SECURITY.md └── workflows │ ├── analyse.yml │ ├── changelog.yml │ └── style.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── composer.json ├── config └── magento-products-nova.php ├── phpstan.neon └── src ├── Nova ├── Actions │ ├── CheckAllKnownProductsExistence.php │ ├── CheckKnownProductsExistence.php │ └── DiscoverMagentoProducts.php ├── Filters │ └── StoreFilter.php └── MagentoProductsResource.php └── ServiceProvider.php /.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | charset = utf-8 3 | end_of_line = lf 4 | insert_final_newline = true 5 | indent_style = space 6 | indent_size = 4 7 | trim_trailing_whitespace = true 8 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions are **welcome** and will be fully **credited**. 4 | 5 | Please read and understand the contribution guide before creating an issue or pull request. 6 | 7 | ## Etiquette 8 | 9 | This project is open source, and as such, the maintainers give their free time to build and maintain the source code 10 | held within. They make the code freely available in the hope that it will be of use to other developers. It would be 11 | extremely unfair for them to suffer abuse or anger for their hard work. 12 | 13 | Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the 14 | world that developers are civilized and selfless people. 15 | 16 | It's the duty of the maintainer to ensure that all submissions to the project are of sufficient 17 | quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used. 18 | 19 | ## Viability 20 | 21 | When requesting or submitting new features, first consider whether it might be useful to others. Open 22 | source projects are used by many developers, who may have entirely different needs to your own. Think about 23 | whether or not your feature is likely to be used by other users of the project. 24 | 25 | ## Procedure 26 | 27 | Before filing an issue: 28 | 29 | - Attempt to replicate the problem, to ensure that it wasn't a coincidental incident. 30 | - Check to make sure your feature suggestion isn't already present within the project. 31 | - Check the pull requests tab to ensure that the bug doesn't have a fix in progress. 32 | - Check the pull requests tab to ensure that the feature isn't already in progress. 33 | 34 | Before submitting a pull request: 35 | 36 | - Check the codebase to ensure that your feature doesn't already exist. 37 | - Check the pull requests to ensure that another person hasn't already submitted the feature or fix. 38 | 39 | ## Requirements 40 | 41 | If the project maintainer has any additional requirements, you will find them listed here. 42 | 43 | - **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer). 44 | 45 | - **Add tests!** - Your patch won't be accepted if it doesn't have tests. 46 | 47 | - **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. 48 | 49 | - **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option. 50 | 51 | - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. 52 | 53 | - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. 54 | 55 | **Happy coding**! 56 | -------------------------------------------------------------------------------- /.github/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | If you discover any security related issues, please email security@justbetter.nl instead of using the issue tracker. 4 | -------------------------------------------------------------------------------- /.github/workflows/analyse.yml: -------------------------------------------------------------------------------- 1 | name: analyse 2 | 3 | on: ['push', 'pull_request'] 4 | 5 | jobs: 6 | test: 7 | runs-on: ${{ matrix.os }} 8 | strategy: 9 | fail-fast: true 10 | matrix: 11 | os: [ubuntu-latest] 12 | php: [8.3, 8.4] 13 | laravel: [11.*] 14 | stability: [prefer-stable] 15 | include: 16 | - laravel: 11.* 17 | testbench: 9.* 18 | 19 | name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} 20 | 21 | steps: 22 | - name: Checkout code 23 | uses: actions/checkout@v4 24 | 25 | - name: Setup PHP 26 | uses: shivammathur/setup-php@v2 27 | with: 28 | php-version: ${{ matrix.php }} 29 | extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo 30 | coverage: none 31 | 32 | - name: Install dependencies 33 | env: 34 | COMPOSER_AUTH: '{"http-basic":{"nova.laravel.com":{"username":"${{secrets.NOVA_USERNAME}}","password":"${{secrets.NOVA_PASSWORD}}"}}}' 35 | run: | 36 | composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update 37 | composer update --${{ matrix.stability }} --prefer-dist --no-interaction 38 | - name: Analyse 39 | run: composer analyse 40 | -------------------------------------------------------------------------------- /.github/workflows/changelog.yml: -------------------------------------------------------------------------------- 1 | name: "Update Changelog" 2 | 3 | on: 4 | release: 5 | types: [ published, edited, deleted ] 6 | 7 | jobs: 8 | generate: 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - name: Checkout code 13 | uses: actions/checkout@v3 14 | with: 15 | ref: ${{ github.event.release.target_commitish }} 16 | 17 | - name: Generate changelog 18 | uses: justbetter/generate-changelogs-action@main 19 | env: 20 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 21 | with: 22 | repository: ${{ github.repository }} 23 | 24 | - name: Commit CHANGELOG 25 | uses: stefanzweifel/git-auto-commit-action@v4 26 | with: 27 | branch: ${{ github.event.release.target_commitish }} 28 | commit_message: Update CHANGELOG 29 | file_pattern: CHANGELOG.md -------------------------------------------------------------------------------- /.github/workflows/style.yml: -------------------------------------------------------------------------------- 1 | name: style 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | jobs: 8 | style: 9 | name: Style 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v4 15 | 16 | - name: Setup PHP 17 | uses: shivammathur/setup-php@v2 18 | with: 19 | php-version: 8.4 20 | extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo 21 | coverage: none 22 | 23 | - name: Install dependencies 24 | env: 25 | COMPOSER_AUTH: '{"http-basic":{"nova.laravel.com":{"username":"${{secrets.NOVA_USERNAME}}","password":"${{secrets.NOVA_PASSWORD}}"}}}' 26 | run: composer install 27 | 28 | - name: Style 29 | run: composer fix-style 30 | 31 | - name: Commit Changes 32 | uses: stefanzweifel/git-auto-commit-action@v4 33 | with: 34 | commit_message: Fix styling changes 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | composer.lock 3 | .phpunit.result.cache 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | [Unreleased changes](https://github.com/justbetter/laravel-magento-products-nova/compare/4.2.0...main) 4 | ## [4.2.0](https://github.com/justbetter/laravel-magento-products-nova/releases/tag/4.2.0) - 2025-02-17 5 | 6 | ### What's Changed 7 | * Renamed resource as it usually is set in its own Magento group by @fritsjustbetter in https://github.com/justbetter/laravel-magento-products-nova/pull/5 8 | * Laravel 12 / Nova 5 support by @VincentBean in https://github.com/justbetter/laravel-magento-products-nova/pull/6 9 | 10 | ### New Contributors 11 | * @fritsjustbetter made their first contribution in https://github.com/justbetter/laravel-magento-products-nova/pull/5 12 | 13 | **Full Changelog**: https://github.com/justbetter/laravel-magento-products-nova/compare/4.1.2...4.2.0 14 | 15 | ## [4.1.2](https://github.com/justbetter/laravel-magento-products-nova/releases/tag/4.1.2) - 2023-06-15 16 | 17 | * Use Nova's action response 18 | 19 | **Full Changelog**: https://github.com/justbetter/laravel-magento-products-nova/compare/4.1.1...4.1.2 20 | 21 | ## [4.1.1](https://github.com/justbetter/laravel-magento-products-nova/releases/tag/4.1.1) - 2023-03-13 22 | 23 | ### What's Changed 24 | * Add store to Nova by @VincentBean in https://github.com/justbetter/laravel-magento-products-nova/pull/3 25 | 26 | 27 | **Full Changelog**: https://github.com/justbetter/laravel-magento-products-nova/compare/4.1.0...4.1.1 28 | 29 | ## [4.1.0](https://github.com/justbetter/laravel-magento-products-nova/releases/tag/4.1.0) - 2023-03-10 30 | 31 | ### What's Changed 32 | * Support Laravel 10 by @VincentBean in https://github.com/justbetter/laravel-magento-products-nova/pull/2 33 | 34 | ### New Contributors 35 | * @VincentBean made their first contribution in https://github.com/justbetter/laravel-magento-products-nova/pull/2 36 | 37 | **Full Changelog**: https://github.com/justbetter/laravel-magento-products-nova/compare/4.0.2...4.1.0 38 | 39 | ## [4.0.2](https://github.com/justbetter/laravel-magento-products-nova/releases/tag/4.0.2) - 2023-01-04 40 | 41 | ### What's Changed 42 | * Updated reference in composer description by @ramonrietdijk in https://github.com/justbetter/laravel-magento-products-nova/pull/1 43 | 44 | ### New Contributors 45 | * @ramonrietdijk made their first contribution in https://github.com/justbetter/laravel-magento-products-nova/pull/1 46 | 47 | **Full Changelog**: https://github.com/justbetter/laravel-magento-products-nova/compare/4.0.1...4.0.2 48 | 49 | ## [4.0.1](https://github.com/justbetter/laravel-magento-products-nova/releases/tag/4.0.1) - 2022-10-31 50 | 51 | **Full Changelog**: https://github.com/justbetter/laravel-magento-products-nova/compare/4.0.0...4.0.1 52 | 53 | ## [4.0.0](https://github.com/justbetter/laravel-magento-products-nova/releases/tag/4.0.0) - 2022-09-20 54 | 55 | **Full Changelog**: https://github.com/justbetter/laravel-magento-products-nova/commits/4.0.0 56 | 57 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) JustBetter 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | persons to whom the Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Laravel Magento Products Nova 2 | 3 | This package is the Laravel Nova integration for `justbetter/laravel-magento-products`. 4 | 5 | ## Installation 6 | 7 | Install the package. 8 | 9 | ```shell 10 | composer require justbetter/laravel-magento-products-nova 11 | ``` 12 | 13 | ## Versioning 14 | 15 | Our major version corresponds to the major Nova version. 16 | 17 | | Package version | Nova version | 18 | |-----------------|--------------| 19 | | `^4.0` | `^4.0` | 20 | 21 | ## Contributing 22 | 23 | Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details. 24 | 25 | ## Security Vulnerabilities 26 | 27 | Please review [our security policy](../../security/policy) on how to report security vulnerabilities. 28 | 29 | ## Credits 30 | 31 | - [Vincent Boon](https://github.com/VincentBean) 32 | - [All Contributors](../../contributors) 33 | 34 | ## License 35 | 36 | The MIT License (MIT). Please see [License File](LICENSE) for more information. 37 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "justbetter/laravel-magento-products-nova", 3 | "description": "Nova integration for justbetter/laravel-magento-products", 4 | "type": "package", 5 | "license": "MIT", 6 | "authors": [ 7 | { 8 | "name": "Vincent Boon", 9 | "email": "vincent@justbetter.nl", 10 | "role": "Developer" 11 | } 12 | ], 13 | "require": { 14 | "php": "^8.3", 15 | "justbetter/laravel-magento-products": "^1.2", 16 | "laravel/framework": "^11.0|^12.0", 17 | "laravel/nova": "^5.0" 18 | }, 19 | "require-dev": { 20 | "larastan/larastan": "^3.0", 21 | "laravel/pint": "^1.20", 22 | "orchestra/testbench": "^9.0" 23 | }, 24 | "autoload": { 25 | "psr-4": { 26 | "JustBetter\\MagentoProductsNova\\": "src" 27 | } 28 | }, 29 | "config": { 30 | "sort-packages": true 31 | }, 32 | "extra": { 33 | "laravel": { 34 | "providers": [ 35 | "JustBetter\\MagentoProductsNova\\ServiceProvider" 36 | ] 37 | } 38 | }, 39 | "minimum-stability": "stable", 40 | "prefer-stable": true, 41 | "repositories": [ 42 | { 43 | "type": "composer", 44 | "url": "https://nova.laravel.com" 45 | } 46 | ], 47 | "scripts": { 48 | "analyse": "phpstan --memory-limit=256M", 49 | "style": "pint --test", 50 | "quality": [ 51 | "@style", 52 | "@analyse" 53 | ] 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /config/magento-products-nova.php: -------------------------------------------------------------------------------- 1 | MagentoProductsResource::class, 9 | 10 | ]; 11 | -------------------------------------------------------------------------------- /phpstan.neon: -------------------------------------------------------------------------------- 1 | includes: 2 | - ./vendor/larastan/larastan/extension.neon 3 | 4 | parameters: 5 | paths: 6 | - src 7 | level: 8 8 | ignoreErrors: 9 | - identifier: missingType.iterableValue 10 | - identifier: missingType.generics 11 | -------------------------------------------------------------------------------- /src/Nova/Actions/CheckAllKnownProductsExistence.php: -------------------------------------------------------------------------------- 1 | pluck('sku')->toArray()); 23 | 24 | return ActionResponse::message('Checking'); 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/Nova/Actions/DiscoverMagentoProducts.php: -------------------------------------------------------------------------------- 1 | where('store', '=', $value); 16 | } 17 | 18 | public function options(NovaRequest $request): array 19 | { 20 | return MagentoProduct::query() 21 | ->select(['store']) 22 | ->distinct() 23 | ->get() 24 | ->pluck('store', 'store') 25 | ->toArray(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Nova/MagentoProductsResource.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | class MagentoProductsResource extends Resource 17 | { 18 | /** @var class-string */ 19 | public static $model = MagentoProduct::class; 20 | 21 | public static $title = 'sku'; 22 | 23 | public static $group = 'products'; 24 | 25 | public static $search = [ 26 | 'sku', 27 | ]; 28 | 29 | public static function label(): string 30 | { 31 | return 'Products'; 32 | } 33 | 34 | public function fields(Request $request): array 35 | { 36 | return [ 37 | Text::make(__('SKU'), 'sku') 38 | ->readonly() 39 | ->sortable(), 40 | 41 | Boolean::make(__('Exists in Magento'), 'exists_in_magento') 42 | ->sortable(), 43 | 44 | Text::make(__('Store'), 'store') 45 | ->readonly() 46 | ->sortable(), 47 | 48 | Code::make(__('Data'), 'data') 49 | ->json(), 50 | 51 | DateTime::make(__('Last checked'), 'last_checked') 52 | ->readonly() 53 | ->sortable(), 54 | 55 | DateTime::make(__('Created At'), 'created_at') 56 | ->readonly() 57 | ->sortable(), 58 | 59 | DateTime::make(__('Updated At'), 'updated_at') 60 | ->readonly() 61 | ->sortable(), 62 | ]; 63 | } 64 | 65 | public function actions(Request $request): array 66 | { 67 | return [ 68 | Actions\DiscoverMagentoProducts::make(), 69 | Actions\CheckKnownProductsExistence::make(), 70 | Actions\CheckAllKnownProductsExistence::make(), 71 | ]; 72 | } 73 | 74 | public function filters(Request $request): array 75 | { 76 | return [ 77 | Filters\StoreFilter::make(), 78 | ]; 79 | } 80 | 81 | public static function authorizedToCreate(Request $request): bool 82 | { 83 | return false; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/ServiceProvider.php: -------------------------------------------------------------------------------- 1 | registerConfig(); 15 | } 16 | 17 | protected function registerConfig(): static 18 | { 19 | $this->mergeConfigFrom(__DIR__.'/../config/magento-products-nova.php', 'magento-products-nova'); 20 | 21 | return $this; 22 | } 23 | 24 | public function boot(): void 25 | { 26 | $this->bootConfig() 27 | ->bootResources(); 28 | } 29 | 30 | protected function bootConfig(): static 31 | { 32 | $this->publishes([ 33 | __DIR__.'/../config/magento-products-nova.php' => config_path('magento-products-nova.php'), 34 | ], 'config'); 35 | 36 | return $this; 37 | } 38 | 39 | 40 | protected function bootResources(): static 41 | { 42 | Nova::resources([ 43 | config('magento-products-nova.resource'), 44 | ]); 45 | 46 | return $this; 47 | } 48 | } 49 | --------------------------------------------------------------------------------