lucabecchetti / laravel-mysql-partition

Useful Laravel package to easily work with MySQL Partition
Other
137 stars 23 forks source link

Call to undefined method Model::partition #11

Closed Allgoodnamesargone closed 1 year ago

Allgoodnamesargone commented 1 year ago

Hello

Getting Call to undefined method App\Models\TestModel::partition() whenever i use TestModel::partition('test2023')->first()

laravel-mysql-partition: 1.1.0 Laravel: 9.41 PHP 8.1

Any solution or workaround to select partitions in Eloquent?

Thanks for the package.

@lucabecchetti

Allgoodnamesargone commented 1 year ago

Has been using this package alongside with archtechx/tenancy package and not yet sure if that was the reason of this issue, but the fix was to add brokenice/laravel-mysql-partition to the dont-discover array in composer.json and adding Brokenice\LaravelMysqlPartition\PartitionServiceProvider::class, to the config/app.php providers array after App\Providers\TenancyServiceProvider::class, I have tested and things are still tenant-aware, however, i may have missed some other use-cases.