From 73c77b1435cb62b6fe78209f7306891620f9cb71 Mon Sep 17 00:00:00 2001 From: Stefano Novelli Date: Fri, 19 Jul 2024 15:50:22 +0200 Subject: [PATCH 1/2] Add Laravel Pint and GitHub workflow --- .github/workflows/pint.yml | 30 +++++++++++++++++++++ composer.json | 5 +++- pint.json | 3 +++ src/App/Http/Controllers/BusyController.php | 3 +-- src/NovaBusyResourceField.php | 3 +-- 5 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/pint.yml create mode 100644 pint.json diff --git a/.github/workflows/pint.yml b/.github/workflows/pint.yml new file mode 100644 index 0000000..dc7f135 --- /dev/null +++ b/.github/workflows/pint.yml @@ -0,0 +1,30 @@ +name: Laravel Pint + +on: + pull_request: + push: + branches: [main] + +jobs: + pint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + tools: composer:v2 + + - name: Install Dependencies + run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + + - name: Run Laravel Pint + run: vendor/bin/pint --test + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Fix styling diff --git a/composer.json b/composer.json index cc8dec5..e222e2a 100644 --- a/composer.json +++ b/composer.json @@ -25,5 +25,8 @@ "sort-packages": true }, "minimum-stability": "dev", - "prefer-stable": true + "prefer-stable": true, + "require-dev": { + "laravel/pint": "^1.16" + } } diff --git a/pint.json b/pint.json new file mode 100644 index 0000000..02b0834 --- /dev/null +++ b/pint.json @@ -0,0 +1,3 @@ +{ + "preset": "laravel" +} diff --git a/src/App/Http/Controllers/BusyController.php b/src/App/Http/Controllers/BusyController.php index a1d1db2..3ecf149 100644 --- a/src/App/Http/Controllers/BusyController.php +++ b/src/App/Http/Controllers/BusyController.php @@ -7,7 +7,6 @@ use Illuminate\Http\Request; use Illuminate\Support\Str; - class BusyController extends Controller { public function storeBusy(Request $request) @@ -42,7 +41,7 @@ public function isBusy(Request $request) $resource = $this->getResource($request['model-id'], $request['model-name']); - if(! $resource) { + if (! $resource) { return response()->json([ 'success' => false, 'data' => null, diff --git a/src/NovaBusyResourceField.php b/src/NovaBusyResourceField.php index 2ea62ab..ed3ebb0 100644 --- a/src/NovaBusyResourceField.php +++ b/src/NovaBusyResourceField.php @@ -3,7 +3,6 @@ namespace The3labsTeam\NovaBusyResourceField; use Laravel\Nova\Fields\Field; -use Laravel\Nova\Http\Requests\NovaRequest; class NovaBusyResourceField extends Field { @@ -34,4 +33,4 @@ public function resolve($resource, $attribute = null) 'isBusyByCurrentUser' => $isBusyByCurrentUser, ]); } -} \ No newline at end of file +} From 7c1ddf8bb5aec5b4cba7fd7ae24cc8c36c747389 Mon Sep 17 00:00:00 2001 From: Stefano Novelli Date: Fri, 19 Jul 2024 16:55:22 +0200 Subject: [PATCH 2/2] Update pint.yml --- .github/workflows/pint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pint.yml b/.github/workflows/pint.yml index dc7f135..d9dcccd 100644 --- a/.github/workflows/pint.yml +++ b/.github/workflows/pint.yml @@ -22,7 +22,7 @@ jobs: run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - name: Run Laravel Pint - run: vendor/bin/pint --test + run: vendor/bin/pint - name: Commit changes uses: stefanzweifel/git-auto-commit-action@v4