Skip to content

Commit c582e6f

Browse files
authored
Assorted refinements (#33)
* Update Composer scripts * Install and set up `laravel/horizon` * Replace PNPM with Bun * Update NPM dependencies * Update Composer dependencies * Update php.yml * Update _variables.scss * Update Notice.vue * Change Sass `border-radius` function name to `radius` * Fix success notices not displaying after the first time * Update AccountUpdate.php * Fix code style * Update Kernel.php
1 parent 9adf3a8 commit c582e6f

File tree

22 files changed

+1069
-1506
lines changed

22 files changed

+1069
-1506
lines changed

.github/workflows/php.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
- name: Install Composer dependencies
2727
if: steps.cache-vendor.outputs.cache-hit != 'true'
28-
run: composer install --no-interaction
28+
run: composer build:test
2929

3030
lint:
3131
name: Lint
@@ -48,15 +48,20 @@ jobs:
4848
tools: composer:v2
4949

5050
- name: Build
51-
run: composer build:lint
51+
if: steps.cache-vendor.outputs.cache-hit != 'true'
52+
run: build:test
5253

5354
- name: Lint against Laravel code style
5455
run: composer lint
5556

5657
test:
5758
name: Test
58-
needs: [dependencies, lint]
59+
needs: [lint, dependencies]
5960
runs-on: ubuntu-latest
61+
env:
62+
APP_ENV: testing
63+
DB_CONNECTION: sqlite
64+
DB_DATABASE: ":memory:"
6065

6166
steps:
6267
- uses: actions/checkout@v3
@@ -72,14 +77,16 @@ jobs:
7277
with:
7378
php-version: 8.2
7479
tools: composer:v2
75-
coverage: xdebug
80+
81+
- name: Build
82+
if: steps.cache-vendor.outputs.cache-hit != 'true'
83+
run: build:test
7684

7785
- name: Setup application
7886
run: |
7987
cp .env.testing .env
80-
81-
- name: Build
82-
run: composer build:test
88+
php artisan key:generate
89+
php artisan migrate:fresh
8390
8491
- name: Run tests
8592
run: composer test:coverage

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/node_modules
22
/public/build
3+
/public/vendor
34
/public/hot
45
/public/storage
56
/storage/*.key

app/Console/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Kernel extends ConsoleKernel
1414
*/
1515
protected function schedule(Schedule $schedule)
1616
{
17-
// $schedule->command('inspire')->hourly();
17+
$schedule->command('horizon:snapshot')->everyFiveMinutes();
1818
}
1919

2020
/**

app/Http/Requests/Account/AccountUpdate.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,12 @@ public function rules()
2323
],
2424
];
2525
}
26+
27+
public function attributes()
28+
{
29+
return [
30+
'first_name' => 'first name',
31+
'last_name' => 'last name',
32+
];
33+
}
2634
}

app/Models/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ class User extends Authenticatable
1616
{
1717
use HasApiTokens;
1818
use HasFactory;
19-
use Notifiable;
2019
use HasRoles;
20+
use Notifiable;
2121

2222
protected $fillable = [
2323
'first_name',
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace App\Providers;
4+
5+
use Illuminate\Support\Facades\Gate;
6+
use Laravel\Horizon\Horizon;
7+
use Laravel\Horizon\HorizonApplicationServiceProvider;
8+
9+
class HorizonServiceProvider extends HorizonApplicationServiceProvider
10+
{
11+
/**
12+
* Bootstrap any application services.
13+
*/
14+
public function boot(): void
15+
{
16+
parent::boot();
17+
18+
// Horizon::routeSmsNotificationsTo('15556667777');
19+
// Horizon::routeMailNotificationsTo('example@example.com');
20+
// Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');
21+
}
22+
23+
/**
24+
* Register the Horizon gate.
25+
*
26+
* This gate determines who can access Horizon in non-local environments.
27+
*/
28+
protected function gate(): void
29+
{
30+
Gate::define('viewHorizon', function ($user) {
31+
return in_array($user->email, [
32+
'seb@sebkay.com',
33+
]);
34+
});
35+
}
36+
}

bun.lockb

40.5 KB
Binary file not shown.

composer.json

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,25 @@
55
"license": "MIT",
66
"require": {
77
"php": "^8.2",
8-
"guzzlehttp/guzzle": "^7.5",
8+
"guzzlehttp/guzzle": "^7.8",
99
"inertiajs/inertia-laravel": "^0.6",
10-
"laravel/framework": "^10.0",
11-
"laravel/sanctum": "^3.2",
10+
"laravel/framework": "^10.24",
11+
"laravel/horizon": "^5.21",
12+
"laravel/sanctum": "^3.3",
1213
"laravel/tinker": "^2.8",
13-
"spatie/laravel-permission": "^5.9",
14-
"tightenco/ziggy": "^1.5"
14+
"spatie/laravel-permission": "^5.11",
15+
"tightenco/ziggy": "^1.6"
1516
},
1617
"require-dev": {
17-
"fakerphp/faker": "^1.21",
18-
"laravel/pint": "^1.5",
19-
"mockery/mockery": "^1.5",
20-
"nunomaduro/collision": "^7.0",
21-
"pestphp/pest": "^2.0",
18+
"fakerphp/faker": "^1.23",
19+
"laravel/pint": "^1.13",
20+
"mockery/mockery": "^1.6",
21+
"nunomaduro/collision": "^7.9",
22+
"pestphp/pest": "^2.19",
2223
"pestphp/pest-plugin-faker": "^2.0",
23-
"pestphp/pest-plugin-laravel": "^2.0",
24-
"spatie/laravel-ignition": "^2.0",
25-
"spatie/ray": "^1.36"
24+
"pestphp/pest-plugin-laravel": "^2.2",
25+
"spatie/laravel-ignition": "^2.3",
26+
"spatie/ray": "^1.39"
2627
},
2728
"autoload": {
2829
"psr-4": {
@@ -37,25 +38,18 @@
3738
}
3839
},
3940
"scripts": {
40-
"build:lint": [
41-
"composer install --no-interaction"
42-
],
43-
"build:test": [
44-
"composer install --no-interaction",
45-
"php artisan key:generate --env=testing",
46-
"php artisan migrate:fresh --seed --seeder=TestsSeeder"
47-
],
4841
"build:dev": [
4942
"composer install",
50-
"php artisan migrate:fresh --seed",
51-
"pnpm install --node-linker=hoisted",
52-
"pnpm run build"
43+
"@artisan:build",
44+
"@assets:build"
5345
],
5446
"build:prod": [
5547
"composer install --no-interaction --prefer-dist --optimize-autoloader",
56-
"php artisan migrate --force",
57-
"pnpm install --node-linker=hoisted",
58-
"pnpm run build"
48+
"@artisan:build",
49+
"@assets:build"
50+
],
51+
"build:test": [
52+
"composer install --no-interaction"
5953
],
6054
"lint": [
6155
"./vendor/bin/pint --test"
@@ -64,17 +58,28 @@
6458
"./vendor/bin/pint"
6559
],
6660
"test": [
67-
"./vendor/bin/pest --parallel --stop-on-failure --processes=8"
61+
"./vendor/bin/pest --parallel --stop-on-failure"
6862
],
6963
"test:coverage": [
70-
"XDEBUG_MODE=coverage ./vendor/bin/pest --parallel --coverage --min=85 --processes=8 --stop-on-failure"
64+
"XDEBUG_MODE=coverage ./vendor/bin/pest --parallel --stop-on-failure --coverage --min=85"
65+
],
66+
"artisan:build": [
67+
"@php artisan horizon:terminate",
68+
"@php artisan horizon:publish",
69+
"@php artisan cache:clear",
70+
"@php artisan queue:restart"
71+
],
72+
"assets:build": [
73+
"bun install",
74+
"bun run build"
7175
],
7276
"post-autoload-dump": [
7377
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
7478
"@php artisan package:discover --ansi"
7579
],
7680
"post-update-cmd": [
77-
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
81+
"@php artisan vendor:publish --tag=laravel-assets --ansi --force",
82+
"@php artisan horizon:publish --ansi"
7883
],
7984
"post-root-package-install": [
8085
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""

0 commit comments

Comments
 (0)