Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
ee0599d
Update README.md
ousid Nov 24, 2023
71fe04e
fix conflict
ousid Apr 1, 2024
5324028
add `Laravel 11.x` support
ousid Apr 8, 2024
649e6c1
update `run-tests.yml`
ousid Apr 8, 2024
dc5e3cb
update `composer.json`
ousid Apr 8, 2024
5647d52
update `run-tests.yml`
ousid Apr 8, 2024
a786028
update `composer.json`
ousid Apr 8, 2024
4a34047
Bump aglipanci/laravel-pint-action from 2.3.1 to 2.4
dependabot[bot] Apr 15, 2024
fb7beeb
Merge pull request #16 from coderflexx/dependabot/github_actions/agli…
github-actions[bot] Apr 15, 2024
583b155
Bump dependabot/fetch-metadata from 2.0.0 to 2.1.0
dependabot[bot] Apr 29, 2024
2e97ccd
Merge pull request #17 from coderflexx/dependabot/github_actions/depe…
github-actions[bot] Apr 29, 2024
3d73046
Update run-tests.yml
ousid May 4, 2024
85735c6
Merge pull request #15 from coderflexx/l11-support
ousid May 4, 2024
9ac756f
Bump dependabot/fetch-metadata from 2.1.0 to 2.2.0
dependabot[bot] Jul 8, 2024
a2acd79
Merge pull request #18 from coderflexx/dependabot/github_actions/depe…
github-actions[bot] Jul 8, 2024
002163a
Fixed wrong default language format
billmn Aug 9, 2024
d74a01c
Merge pull request #19 from billmn/patch-1
ousid Aug 29, 2024
bde2332
Fix styling
ousid Aug 29, 2024
592a91e
lazy load assets and avoid push scripts
tanthammar Jan 13, 2025
ad8d478
Bump dependabot/fetch-metadata from 2.2.0 to 2.3.0
dependabot[bot] Jan 27, 2025
92c66c6
Merge pull request #22 from coderflexx/dependabot/github_actions/depe…
github-actions[bot] Jan 27, 2025
311ff29
Bump aglipanci/laravel-pint-action from 2.4 to 2.5
dependabot[bot] Feb 3, 2025
e907852
Merge pull request #23 from coderflexx/dependabot/github_actions/agli…
github-actions[bot] Feb 3, 2025
c30a354
Update composer.json
lancepioch Feb 28, 2025
066e994
update yml test file
ousid Mar 1, 2025
ad4bfd4
update composer.json
ousid Mar 1, 2025
2fdf966
update composer.json
ousid Mar 1, 2025
2fcca9a
wip
ousid Mar 1, 2025
02be101
wip
ousid Mar 1, 2025
1a69490
update composer.json
ousid Mar 1, 2025
ef24e83
add composer.json
ousid Mar 1, 2025
66584d3
Merge pull request #26 from coderflexx/pr-25
ousid Mar 1, 2025
a49cf62
Merge pull request #21 from tanthammar/patch-1
ousid Mar 1, 2025
7433ce4
Bump dependabot/fetch-metadata from 2.3.0 to 2.4.0
dependabot[bot] May 12, 2025
edab3c1
Merge pull request #28 from coderflexx/dependabot/github_actions/depe…
github-actions[bot] May 12, 2025
ac99fd3
Bump stefanzweifel/git-auto-commit-action from 4 to 6
dependabot[bot] Jun 16, 2025
bad49ca
Bump aglipanci/laravel-pint-action from 2.5 to 2.6
dependabot[bot] Aug 5, 2025
23f00a2
Merge pull request #30 from coderflexx/dependabot/github_actions/agli…
github-actions[bot] Aug 5, 2025
a63ca21
Bump actions/checkout from 3 to 5
dependabot[bot] Aug 12, 2025
089b25b
Fix destroyed when element visibility changes
tanthammar Aug 26, 2025
cbe8e75
Merge pull request #1 from tanthammar/tanthammar-visibilty-fix
tanthammar Aug 26, 2025
f22017e
Merge pull request #32 from tanthammar/2.x
ousid Sep 17, 2025
5031744
Merge pull request #31 from coderflexx/dependabot/github_actions/acti…
ousid Sep 17, 2025
cafdf3c
Merge pull request #29 from coderflexx/dependabot/github_actions/stef…
ousid Sep 17, 2025
75c40a0
Bump stefanzweifel/git-auto-commit-action from 6 to 7
dependabot[bot] Oct 13, 2025
add373d
Fix multiple instances
tanthammar Oct 19, 2025
7822770
remove obsolete data attr.
tanthammar Oct 22, 2025
8a54a32
Merge pull request #35 from tanthammar/patch-2
ousid Oct 25, 2025
f2e02ee
Merge pull request #34 from coderflexx/dependabot/github_actions/stef…
ousid Oct 25, 2025
7f3be8c
Bump actions/checkout from 5 to 6
dependabot[bot] Nov 24, 2025
947fc4e
Merge pull request #38 from coderflexx/dependabot/github_actions/acti…
ousid Dec 2, 2025
972ea5e
feat: Upgrade Filament to v4, refactor forms to use Schema, and updat…
sabitahmadumid Jan 5, 2026
5cb0a3c
fix: Add branch 3.x to workflow triggers for push and pull requests
sabitahmadumid Jan 5, 2026
5dba79b
feat: Update PHP version to 8.2 in workflow, allow PHP 8.4 in compose…
sabitahmadumid Jan 9, 2026
65278ad
fix: Update carbon version constraints to allow any version in test m…
sabitahmadumid Jan 9, 2026
7528baa
Merge branch '3.x' into 3.x
sabitahmadumid Jan 9, 2026
72d2c84
Merge branch '3.x' into 3.x
ousid Jan 19, 2026
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
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2.0.0
uses: dependabot/fetch-metadata@v2.4.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/fix-php-code-style-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}

- name: Fix PHP code style issues
uses: aglipanci/laravel-pint-action@2.3.1
uses: aglipanci/laravel-pint-action@2.6

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: Fix styling
4 changes: 2 additions & 2 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
name: phpstan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
coverage: none

- name: Install composer dependencies
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@ name: run-tests

on:
push:
branches: [main]
branches:
- main
- 1.x
- 2.x
- 3.x
pull_request:
branches: [main]
branches:
- main
- 1.x
- 2.x
- 3.x

jobs:
test:
Expand All @@ -28,7 +36,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v6
with:
ref: main

Expand All @@ -24,7 +24,7 @@ jobs:
release-notes: ${{ github.event.release.body }}

- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v7
with:
branch: main
commit_message: Update CHANGELOG
Expand Down
23 changes: 11 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,23 @@
}
],
"require": {
"php": "^8.2",
"coderflex/laravel-turnstile": "^2.0",
"illuminate/contracts": "^11.0 || ^12.0",
"php": "^8.2|^8.3|^8.4",
"coderflex/laravel-turnstile": "^1.0|^2.0",
"illuminate/contracts": "^10.0|^11.0|^12.0",
"spatie/laravel-package-tools": "^1.14.0"
},
"require-dev": {
"filament/filament": "^4.0",
"larastan/larastan": "^2.8|^3.0",
"laravel/pint": "^1.0",
"nunomaduro/collision": "^8.0",
"nunomaduro/larastan": "^3.0",
"orchestra/testbench": "^10.0",
"pestphp/pest": "^3.0",
"pestphp/pest-plugin-arch": "^3.0",
"pestphp/pest-plugin-laravel": "^3.0",
"pestphp/pest-plugin-livewire": "^3.0",
"nunomaduro/collision": "^7.0|^8.0",
"orchestra/testbench": "^8.0|^9.0|^10.0",
"pestphp/pest": "^2.0|^3.7",
"pestphp/pest-plugin-arch": "^2.0|^3.0",
"pestphp/pest-plugin-livewire": "^2.0|^3.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^2.0",
"phpstan/phpstan-phpunit": "^2.0"
"phpstan/phpstan-deprecation-rules": "^1.0|^2.0",
"phpstan/phpstan-phpunit": "^1.0|^2.0"
},
"autoload": {
"psr-4": {
Expand Down
76 changes: 44 additions & 32 deletions resources/views/components/turnstile.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,60 @@

<x-dynamic-component :component="$fieldWrapperView" :field="$turnstile">

<div x-data="{
state: $wire.entangle('{{ $statePath }}').defer
<div wire:ignore
x-load-js="['https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit&onload=onTurnstileLoad']"
x-data="{
state: $wire.entangle('{{ $statePath }}').defer,
widgetId: null,
}"
wire:ignore
x-init="(() => {
let options= {
x-init="(() => {
let options = {
sitekey: '{{config('turnstile.turnstile_site_key')}}',
theme: '{{ $theme }}',
size: '{{ $size }}',
language: '{{ $language }}',
callback: function (token) {
$wire.set('{{ $statePath }}', token)
},

errorCallback: function () {
'error-callback': function () {
$wire.set('{{ $statePath }}', null)
},
}
}

window.onloadTurnstileCallback = () => {
turnstile.render($refs.turnstile, options)
// Render widget when Turnstile API is ready
const renderWidget = () => {
if (!window.turnstile || !$refs.turnstile || widgetId !== null) {
return;
}

widgetId = turnstile.render($refs.turnstile, options);
}

resetCaptcha = () => {
turnstile.reset($refs.turnstile)
// Called when Turnstile API loads
window.onTurnstileLoad = () => {
renderWidget();
}
})()"
>
<div data-sitekey="{{config('turnstile.turnstile_site_key')}}"
data-theme="{{ $theme }}"
data-language="{{ $language }}"
data-size="{{ $size }}"
x-ref="turnstile"
>
</div>
</div>

<script src="https://challenges.cloudflare.com/turnstile/v0/api.js?onload=onloadTurnstileCallback" defer></script>
// If API already loaded (on re-render), render immediately
if (window.turnstile) {
renderWidget();
}

@push('scripts')
<script>
document.addEventListener('livewire:init', () => {
Livewire.on('reset-captcha', (event) => {
resetCaptcha()
})
$wire.on('reset-captcha', () => {
if (widgetId !== null && window.turnstile) {
turnstile.reset(widgetId);
}
})
</script>
@endpush
</x-dynamic-component>

// Cleanup when component is destroyed
return () => {
if (widgetId !== null && window.turnstile) {
turnstile.remove(widgetId);
widgetId = null;
}
}
})()"
>
<div x-ref="turnstile"></div>
</div>
</x-dynamic-component>
17 changes: 4 additions & 13 deletions src/Forms/Components/Turnstile.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Turnstile extends Field

protected string $size = 'normal';

protected string $language = 'en-US';
protected string $language = 'en-us';

protected function setUp(): void
{
Expand Down Expand Up @@ -51,26 +51,17 @@ public function language(string $language): static
return $this;
}

/**
* @return string
*/
public function getTheme()
public function getTheme(): string
{
return $this->evaluate($this->theme);
}

/**
* @return string
*/
public function getSize()
public function getSize(): string
{
return $this->evaluate($this->size);
}

/**
* @return string
*/
public function getLanguage()
public function getLanguage(): string
{
return $this->evaluate($this->language);
}
Expand Down
8 changes: 7 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,25 @@ protected function setUp(): void
config()->set('app.key', '6rE9Nz59bGRbeMATftriyQjrpF7DcOQm');

$this->setCurrentFilamentPanel();

// Ensure DataStore is fresh for each test
// The issue was that Livewire's DataStore singleton (which holds component state) was not being correctly reset between tests in this environment, causing state persistence failures.
$this->app->forgetInstance(\Livewire\Mechanisms\DataStore::class);
$this->app->singleton(\Livewire\Mechanisms\DataStore::class);
}

protected function getPackageProviders($app)
{
return [
LivewireServiceProvider::class,
ActionsServiceProvider::class,
BladeCaptureDirectiveServiceProvider::class,
BladeHeroiconsServiceProvider::class,
BladeIconsServiceProvider::class,
FilamentServiceProvider::class,
FormsServiceProvider::class,
\Filament\Schemas\SchemasServiceProvider::class,
InfolistsServiceProvider::class,
LivewireServiceProvider::class,
NotificationsServiceProvider::class,
SupportServiceProvider::class,
TablesServiceProvider::class,
Expand Down
Loading