Skip to content

Commit d40f0b9

Browse files
last commit
1 parent 270eb09 commit d40f0b9

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
# To Raw SQL
77

8+
⚠️ The `toRawSql()` function is included by default in Laravel 10.14.2. You don't need to install this package if your Laravel version is greater than 10.14.1 ⚠️
9+
810
Get raw SQL from Laravel Query Builder and Eloquent Builder
911

1012
## Installation
@@ -36,6 +38,8 @@ DB::table('users')
3638

3739
## Version History
3840

41+
- 1.1.3
42+
- Do not register the `toRawSql()` macro if the Laravel version is greater than 10.14.1
3943
- 1.1.2
4044
- throw ToRawSqlException when encountering PostgreSQL jsonb operator errors
4145
- 1.1.1

src/ToRawSqlServiceProvider.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use PyaeSoneAung\ToRawSql\Concerns\QueryBuilderMacros;
77
use Spatie\LaravelPackageTools\Package;
88
use Spatie\LaravelPackageTools\PackageServiceProvider;
9+
use Illuminate\Foundation\Application;
910

1011
class ToRawSqlServiceProvider extends PackageServiceProvider
1112
{
@@ -14,8 +15,11 @@ class ToRawSqlServiceProvider extends PackageServiceProvider
1415

1516
public function boot(): void
1617
{
17-
$this->registerEloquentBuilderMacros();
18-
$this->registerQueryBuilderMacros();
18+
// skip if laravel version is greater than 10.14.1
19+
if (version_compare(Application::VERSION, '10.14.1', '<=') === true) {
20+
$this->registerEloquentBuilderMacros();
21+
$this->registerQueryBuilderMacros();
22+
}
1923
}
2024

2125
public function configurePackage(Package $package): void

0 commit comments

Comments
 (0)