Skip to content

Commit

Permalink
Merge pull request #6 from justbetter/feature/laravel12
Browse files Browse the repository at this point in the history
Laravel 12 / Nova 5 support
  • Loading branch information
VincentBean authored Feb 17, 2025
2 parents 1c0600d + fd32b04 commit 11fbd8f
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 6 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/analyse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: analyse

on: ['push', 'pull_request']

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.3, 8.4]
laravel: [11.*]
stability: [prefer-stable]
include:
- laravel: 11.*
testbench: 9.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Install dependencies
env:
COMPOSER_AUTH: '{"http-basic":{"nova.laravel.com":{"username":"${{secrets.NOVA_USERNAME}}","password":"${{secrets.NOVA_PASSWORD}}"}}}'
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Analyse
run: composer analyse
34 changes: 34 additions & 0 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: style

on:
push:
branches:
- main
jobs:
style:
name: Style
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Install dependencies
env:
COMPOSER_AUTH: '{"http-basic":{"nova.laravel.com":{"username":"${{secrets.NOVA_USERNAME}}","password":"${{secrets.NOVA_PASSWORD}}"}}}'
run: composer install

- name: Style
run: composer fix-style

- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix styling changes
22 changes: 18 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@
}
],
"require": {
"php": "^8.1",
"laravel/nova": "^4.0",
"justbetter/laravel-magento-products": "^1.2"
"php": "^8.3",
"justbetter/laravel-magento-products": "^1.2",
"laravel/framework": "^11.0|^12.0",
"laravel/nova": "^5.0"
},
"require-dev": {
"larastan/larastan": "^3.0",
"laravel/pint": "^1.20",
"orchestra/testbench": "^9.0"
},
"autoload": {
"psr-4": {
Expand All @@ -37,5 +43,13 @@
"type": "composer",
"url": "https://nova.laravel.com"
}
]
],
"scripts": {
"analyse": "phpstan --memory-limit=256M",
"style": "pint --test",
"quality": [
"@style",
"@analyse"
]
}
}
10 changes: 10 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
includes:
- ./vendor/larastan/larastan/extension.neon

parameters:
paths:
- src
level: 8
ignoreErrors:
- identifier: missingType.iterableValue
- identifier: missingType.generics
3 changes: 2 additions & 1 deletion src/Nova/Filters/StoreFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

namespace JustBetter\MagentoProductsNova\Nova\Filters;

use Illuminate\Contracts\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Eloquent\Builder;
use JustBetter\MagentoProducts\Models\MagentoProduct;
use Laravel\Nova\Filters\Filter;
use Laravel\Nova\Http\Requests\NovaRequest;

class StoreFilter extends Filter
{
public function apply(NovaRequest $request, $query, $value): Builder
public function apply(NovaRequest $request, EloquentBuilder $query, mixed $value): Builder|EloquentBuilder
{
return $query->where('store', '=', $value);
}
Expand Down
6 changes: 5 additions & 1 deletion src/Nova/MagentoProductsResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,20 @@
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Resource;

/**
* @extends Resource<MagentoProduct>
*/
class MagentoProductsResource extends Resource
{
/** @var class-string<MagentoProduct> */
public static $model = MagentoProduct::class;

public static $title = 'sku';

public static $group = 'products';

public static $search = [
'sku'
'sku',
];

public static function label(): string
Expand Down

0 comments on commit 11fbd8f

Please sign in to comment.