Skip to content

Commit 2e9e346

Browse files
Laravel 11 (#43)
* build: Added laravel 11 support * dev: Test composer name * build: Remove Laravel 9 and 10 support * build: Rename composer name back to sourcetoad * chore: align php82/83 * docs: point L9/10 to 4.2 * chore: align jbo name to just tests * build: add dependabot checks --------- Co-authored-by: benjie-wd <benjie@support.webartdesign.com.au> Co-authored-by: Benjie Alaan <54299748+benjie-wd@users.noreply.github.com>
1 parent 77a3bcf commit 2e9e346

File tree

9 files changed

+63
-68
lines changed

9 files changed

+63
-68
lines changed

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directories:
5+
- "/.github/**/*"
6+
schedule:
7+
interval: weekly
8+
time: "06:00"
9+
timezone: "America/New_York"

.github/workflows/main.yml

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ on:
33
pull_request:
44
push:
55
jobs:
6-
tests-80:
6+
tests:
77
runs-on: ubuntu-latest
88
strategy:
99
fail-fast: true
1010
matrix:
11-
php: [ 8.0 ]
12-
laravel: [ 9.0 ]
11+
php: [ 8.2, 8.3 ]
12+
laravel: [ 11.0 ]
1313
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
1414
steps:
1515
- name: Checkout code
@@ -38,44 +38,7 @@ jobs:
3838
run: composer require "illuminate/auth:^${{ matrix.laravel }}" "illuminate/config:^${{ matrix.laravel }}" "illuminate/database:^${{ matrix.laravel }}" "illuminate/support:^${{ matrix.laravel }}" "illuminate/translation:^${{ matrix.laravel }}" --prefer-stable --prefer-dist --no-interaction
3939

4040
- name: Execute tests
41-
run: vendor/bin/phpunit --verbose
42-
43-
tests-81:
44-
runs-on: ubuntu-latest
45-
strategy:
46-
fail-fast: true
47-
matrix:
48-
php: [ 8.1 ]
49-
laravel: [ 9.0, 10.0 ]
50-
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
51-
steps:
52-
- name: Checkout code
53-
uses: actions/checkout@v3
54-
55-
- name: Get composer cache directory
56-
id: composer-cache
57-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
58-
59-
- name: Cache dependencies
60-
uses: actions/cache@v3
61-
with:
62-
path: ${{ steps.composer-cache.outputs.dir }}
63-
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ matrix.laravel }}-${{ hashFiles('**/composer.json') }}
64-
restore-keys: ${{ runner.os }}-composer-${{ matrix.php }}-${{ matrix.laravel }}-
65-
66-
- name: Setup PHP
67-
uses: shivammathur/setup-php@v2
68-
with:
69-
php-version: ${{ matrix.php }}
70-
tools: composer:v2
71-
extensions: dom, curl, libxml, mbstring, zip, pcntl, gd, soap
72-
coverage: none
73-
74-
- name: Install dependencies
75-
run: composer require "illuminate/auth:^${{ matrix.laravel }}" "illuminate/config:^${{ matrix.laravel }}" "illuminate/database:^${{ matrix.laravel }}" "illuminate/support:^${{ matrix.laravel }}" "illuminate/translation:^${{ matrix.laravel }}" --prefer-stable --prefer-dist --no-interaction
76-
77-
- name: Execute tests
78-
run: vendor/bin/phpunit --verbose
41+
run: vendor/bin/phpunit
7942

8043
code_styles:
8144
runs-on: ubuntu-latest
@@ -97,7 +60,7 @@ jobs:
9760
- name: Setup PHP
9861
uses: shivammathur/setup-php@v2
9962
with:
100-
php-version: '8.1'
63+
php-version: '8.2'
10164
tools: composer:v2
10265
extensions: dom, curl, libxml, mbstring, zip, pcntl, gd, soap
10366
coverage: none

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ This means that the method for storage must be efficient, unlike other packages
2323

2424
### Laravel
2525

26-
You are reading the documentation for 10.x and 9.x.
26+
You are reading the documentation for 11.x.
2727

28+
* If you're using Laravel 9 or 10 please see the docs for [4.x](https://github.com/sourcetoad/Logger/releases/tag/v4.2.0).
2829
* If you're using Laravel 6, 7 or 8 please see the docs for [3.x](https://github.com/sourcetoad/Logger/releases/tag/v3.0.1).
2930
* If you're using Laravel 5 or below please see docs for [1.x](https://github.com/sourcetoad/Logger/releases/tag/v1.3.0)
3031

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
"prefer-stable": true,
1717
"require": {
1818
"ext-json": "*",
19-
"php": "^8.0|^8.1",
20-
"illuminate/auth": "^9.0|^10.0",
21-
"illuminate/config": "^9.0|^10.0",
22-
"illuminate/database": "^9.0|^10.0",
23-
"illuminate/support": "^9.0|^10.0",
24-
"illuminate/translation": "^9.0|^10.0"
19+
"php": "^8.2|^8.3",
20+
"illuminate/auth": "^11.0",
21+
"illuminate/config": "^11.0",
22+
"illuminate/database": "^11.0",
23+
"illuminate/support": "^11.0",
24+
"illuminate/translation": "^11.0"
2525
},
2626
"autoload": {
2727
"psr-4": {
@@ -44,7 +44,7 @@
4444
}
4545
},
4646
"require-dev": {
47-
"squizlabs/php_codesniffer": "^3.7",
48-
"phpunit/phpunit": "^9.5"
47+
"squizlabs/php_codesniffer": "^3.10",
48+
"phpunit/phpunit": "^11.2"
4949
}
5050
}

config/logger.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
'user' => [
1616
'table' => 'users',
1717
'foreign_key' => 'id',
18+
'foreign_key_type' => 'bigInteger',
1819
],
1920

2021
/*

database/migrations/2019_03_35_000001_create_logger_tables.php

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,15 @@ public function up(): void
2525
$table->bigIncrements('id');
2626
$table->bigInteger('key_id', false, true)->nullable(true);
2727
$table->integer('route_id', false, true);
28-
$table->integer('user_id', false, true)->nullable(true);
28+
$table->addColumn(
29+
config('activity-logger.user.foreign_key_type', 'bigInteger'),
30+
'user_id',
31+
[
32+
'autoIncrement' => false,
33+
'unsigned' => true
34+
]
35+
)
36+
->nullable();
2937

3038
$table->tinyInteger('type', false, true);
3139
$table->tinyInteger('verb', false, true);
@@ -57,7 +65,15 @@ public function up(): void
5765
$table->bigInteger('activity_id', false, true);
5866
$table->mediumInteger('entity_type', false, true);
5967
$table->integer('entity_id', false, true);
60-
$table->integer('user_id', false, true)->nullable(true);
68+
$table->addColumn(
69+
config('activity-logger.user.foreign_key_type', 'bigInteger'),
70+
'user_id',
71+
[
72+
'autoIncrement' => false,
73+
'unsigned' => true,
74+
]
75+
)
76+
->nullable();
6177

6278
$table
6379
->foreign('activity_id')
@@ -77,7 +93,15 @@ public function up(): void
7793
$table->bigInteger('activity_id', false, true);
7894
$table->mediumInteger('entity_type', false, true);
7995
$table->integer('entity_id', false, true);
80-
$table->integer('user_id', false, true)->nullable(true);
96+
$table->addColumn(
97+
config('activity-logger.user.foreign_key_type', 'bigInteger'),
98+
'user_id',
99+
[
100+
'autoIncrement' => false,
101+
'unsigned' => true,
102+
]
103+
)
104+
->nullable();
81105

82106
$table->json('fields');
83107

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:8.1-fpm
1+
FROM php:8.2-fpm
22

33
RUN apt-get update && apt-get install -y \
44
git \

phpunit.xml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="vendor/autoload.php"
3-
backupGlobals="false"
4-
backupStaticAttributes="false"
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
bootstrap="vendor/autoload.php"
54
colors="true"
6-
verbose="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
10-
processIsolation="false"
11-
stopOnFailure="false">
5+
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
6+
cacheDirectory=".phpunit.cache"
7+
>
128
<testsuites>
139
<testsuite name="Logger Test Suite">
1410
<directory>tests</directory>
1511
</testsuite>
1612
</testsuites>
17-
<coverage>
13+
<source>
1814
<include>
1915
<directory suffix=".php">src/</directory>
2016
</include>
21-
</coverage>
17+
</source>
2218
</phpunit>

tests/LoggerArrayParserTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44
namespace Sourcetoad\Logger\Test;
55

66
use Sourcetoad\Logger\Helpers\DataArrayParser;
7+
use PHPUnit\Framework\Attributes\DataProvider;
78

89
class LoggerArrayParserTest extends TestCase
910
{
10-
/** @dataProvider dataProvider */
11+
#[DataProvider('dataProvider')]
1112
public function testDedupeParser(array $input, array $expected): void
1213
{
1314
$this->assertEquals($expected, DataArrayParser::dedupe($input));
1415
}
1516

16-
public function dataProvider(): array
17+
public static function dataProvider(): array
1718
{
1819
return [
1920
'empty' => [

0 commit comments

Comments
 (0)