When you have a model accessor on an Eloquent Model, with an associated field that's showing in the listing table and you go to order by that field, you get a database error about the column not existing in the database.
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'order_date' in 'order clause' (Connection: mysql, SQL: select * from `orders` order by `order_date` asc limit 50 offset 0)
We should prevent fields based on model accessors from being orderable in listing tables.
Steps to reproduce
Add a model accessor to a model
Add a field to your resource's blueprint, with the same handle of the model accessor
Description
When you have a model accessor on an Eloquent Model, with an associated field that's showing in the listing table and you go to order by that field, you get a database error about the column not existing in the database.
We should prevent fields based on model accessors from being orderable in listing tables.
Steps to reproduce
Environment
Environment Application Name: Statamic Laravel Version: 10.42.0 PHP Version: 8.3.0 Composer Version: 2.6.3 Environment: local Debug Mode: ENABLED URL: sc-sandbox.test Maintenance Mode: OFF
Cache Config: NOT CACHED Events: NOT CACHED Routes: NOT CACHED Views: CACHED
Drivers Broadcasting: log Cache: statamic Database: mysql Logs: stack / single Mail: smtp Queue: sync Session: file
Simple Commerce Currencies: GBP Gateways: Stripe, Dummy Repository: Customer: DuncanMcClean\SimpleCommerce\Customers\EloquentCustomerRepository Repository: Order: DuncanMcClean\SimpleCommerce\Orders\EloquentOrderRepository Repository: Product: DuncanMcClean\SimpleCommerce\Products\EntryProductRepository Shipping Methods: Free Shipping Tax Engine: DuncanMcClean\SimpleCommerce\Tax\BasicTaxEngine
Statamic Addons: 2 Antlers: runtime Stache Watcher: Enabled Static Caching: Disabled Version: 4.46.0 PRO
Statamic Addons duncanmcclean/simple-commerce: 6.0.1 statamic-rad-pack/runway: 6.0.4