Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: github-actions
directories:
- "/.github/**/*"
schedule:
interval: weekly
time: "06:00"
timezone: "America/New_York"
47 changes: 5 additions & 42 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ on:
pull_request:
push:
jobs:
tests-80:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [ 8.0 ]
laravel: [ 9.0 ]
php: [ 8.2, 8.3 ]
laravel: [ 11.0 ]
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
steps:
- name: Checkout code
Expand Down Expand Up @@ -38,44 +38,7 @@ jobs:
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

- name: Execute tests
run: vendor/bin/phpunit --verbose

tests-81:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [ 8.1 ]
laravel: [ 9.0, 10.0 ]
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ matrix.laravel }}-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.php }}-${{ matrix.laravel }}-

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
extensions: dom, curl, libxml, mbstring, zip, pcntl, gd, soap
coverage: none

- name: Install dependencies
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

- name: Execute tests
run: vendor/bin/phpunit --verbose
run: vendor/bin/phpunit

code_styles:
runs-on: ubuntu-latest
Expand All @@ -97,7 +60,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
tools: composer:v2
extensions: dom, curl, libxml, mbstring, zip, pcntl, gd, soap
coverage: none
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ This means that the method for storage must be efficient, unlike other packages

### Laravel

You are reading the documentation for 10.x and 9.x.
You are reading the documentation for 11.x.

* 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).
* 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).
* If you're using Laravel 5 or below please see docs for [1.x](https://github.com/sourcetoad/Logger/releases/tag/v1.3.0)

Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
"prefer-stable": true,
"require": {
"ext-json": "*",
"php": "^8.0|^8.1",
"illuminate/auth": "^9.0|^10.0",
"illuminate/config": "^9.0|^10.0",
"illuminate/database": "^9.0|^10.0",
"illuminate/support": "^9.0|^10.0",
"illuminate/translation": "^9.0|^10.0"
"php": "^8.2|^8.3",
"illuminate/auth": "^11.0",
"illuminate/config": "^11.0",
"illuminate/database": "^11.0",
"illuminate/support": "^11.0",
"illuminate/translation": "^11.0"
},
"autoload": {
"psr-4": {
Expand All @@ -44,7 +44,7 @@
}
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.7",
"phpunit/phpunit": "^9.5"
"squizlabs/php_codesniffer": "^3.10",
"phpunit/phpunit": "^11.2"
}
}
1 change: 1 addition & 0 deletions config/logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'user' => [
'table' => 'users',
'foreign_key' => 'id',
'foreign_key_type' => 'bigInteger',
],

/*
Expand Down
30 changes: 27 additions & 3 deletions database/migrations/2019_03_35_000001_create_logger_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ public function up(): void
$table->bigIncrements('id');
$table->bigInteger('key_id', false, true)->nullable(true);
$table->integer('route_id', false, true);
$table->integer('user_id', false, true)->nullable(true);
$table->addColumn(
config('activity-logger.user.foreign_key_type', 'bigInteger'),
'user_id',
[
'autoIncrement' => false,
'unsigned' => true
]
)
->nullable();

$table->tinyInteger('type', false, true);
$table->tinyInteger('verb', false, true);
Expand Down Expand Up @@ -57,7 +65,15 @@ public function up(): void
$table->bigInteger('activity_id', false, true);
$table->mediumInteger('entity_type', false, true);
$table->integer('entity_id', false, true);
$table->integer('user_id', false, true)->nullable(true);
$table->addColumn(
config('activity-logger.user.foreign_key_type', 'bigInteger'),
'user_id',
[
'autoIncrement' => false,
'unsigned' => true,
]
)
->nullable();

$table
->foreign('activity_id')
Expand All @@ -77,7 +93,15 @@ public function up(): void
$table->bigInteger('activity_id', false, true);
$table->mediumInteger('entity_type', false, true);
$table->integer('entity_id', false, true);
$table->integer('user_id', false, true)->nullable(true);
$table->addColumn(
config('activity-logger.user.foreign_key_type', 'bigInteger'),
'user_id',
[
'autoIncrement' => false,
'unsigned' => true,
]
)
->nullable();

$table->json('fields');

Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.1-fpm
FROM php:8.2-fpm

RUN apt-get update && apt-get install -y \
git \
Expand Down
18 changes: 7 additions & 11 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
cacheDirectory=".phpunit.cache"
>
<testsuites>
<testsuite name="Logger Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
</source>
</phpunit>
5 changes: 3 additions & 2 deletions tests/LoggerArrayParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
namespace Sourcetoad\Logger\Test;

use Sourcetoad\Logger\Helpers\DataArrayParser;
use PHPUnit\Framework\Attributes\DataProvider;

class LoggerArrayParserTest extends TestCase
{
/** @dataProvider dataProvider */
#[DataProvider('dataProvider')]
public function testDedupeParser(array $input, array $expected): void
{
$this->assertEquals($expected, DataArrayParser::dedupe($input));
}

public function dataProvider(): array
public static function dataProvider(): array
{
return [
'empty' => [
Expand Down