Skip to content

Commit eecf38f

Browse files
committed
Merge with 2.x
2 parents 971279e + 23b8fdc commit eecf38f

File tree

3 files changed

+64
-9
lines changed

3 files changed

+64
-9
lines changed

.github/workflows/run-tests.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: run-tests
2+
3+
on:
4+
push:
5+
branches: [2.x]
6+
pull_request:
7+
branches: [2.x]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: true
14+
matrix:
15+
os: [ubuntu-latest]
16+
php: [8.4]
17+
laravel: [12.*]
18+
stability: [prefer-stable]
19+
include:
20+
- laravel: 12.*
21+
testbench: 9.*
22+
carbon: 2.*
23+
24+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
25+
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v5
29+
30+
- name: Setup PHP
31+
uses: shivammathur/setup-php@v2
32+
with:
33+
php-version: ${{ matrix.php }}
34+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
35+
coverage: xdebug
36+
37+
- name: Setup problem matchers
38+
run: |
39+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
40+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
41+
42+
- name: Install dependencies
43+
run: |
44+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update
45+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
46+
47+
- name: List Installed Dependencies
48+
run: composer show -D
49+
50+
- name: Execute tests
51+
run: vendor/bin/pest --ci

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<a href="https://laravel.com/docs/12.x"><img src="https://img.shields.io/badge/Laravel-12.x-FF2D20?style=for-the-badge&logo=laravel" alt="Laravel 12"></a>
77
<a href="https://php.net"><img src="https://img.shields.io/badge/PHP-8.3-777BB4?style=for-the-badge&logo=php" alt="PHP 8.3"></a>
88
<a href="https://github.com/Relaticle/custom-fields/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-AGPL--3.0-blue.svg?style=for-the-badge" alt="License"></a>
9+
<a href="https://github.com/relaticle/custom-fields/actions"><img src="https://img.shields.io/github/actions/workflow/status/relaticle/custom-fields/run-tests.yml?branch=2.x&style=for-the-badge&label=tests)" alt="License"></a>
910
</p>
1011

1112
A powerful Laravel/Filament plugin for adding dynamic custom fields to any Eloquent model without database migrations.

src/CustomFields.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,20 +154,23 @@ public static function useSectionModel(string $model): static
154154
}
155155

156156
/**
157-
* Register a custom tenant resolver.
157+
* Register a custom tenant resolver callback.
158+
*
159+
* This allows developers to provide their own tenant resolution logic
160+
* when they extend the CustomField models with custom tenant handling.
161+
*
162+
* The resolver will be called whenever the package needs to determine
163+
* the current tenant context (validation, queries, scopes, etc.).
164+
*
165+
* Example:
166+
* ```
167+
* CustomFields::resolveTenantUsing(fn() => auth()->user()?->company_id);
168+
* ```
158169
*
159170
* @param Closure(): (int|string|null) $callback
160171
*/
161172
public static function resolveTenantUsing(Closure $callback): void
162173
{
163174
TenantContextService::setTenantResolver($callback);
164175
}
165-
166-
/**
167-
* Clear the custom tenant resolver.
168-
*/
169-
public static function clearTenantResolver(): void
170-
{
171-
TenantContextService::clearTenantResolver();
172-
}
173176
}

0 commit comments

Comments
 (0)