This content originally appeared on DEV Community and was authored by Süleyman Özgür Özarpacı
You have to use getTableQuery method for that. This method returns Eloquent Builder or Relation class but for our situation it's going to return Builder class. So we can use that builder to add our queries.
For example i have a relation manager that must be ordered by order_column.
- Open your relation manager file.
- Then add this code:
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\Relation;
protected function getTableQuery(): Builder|Relation
{
return parent::getTableQuery()->orderBy('order_column');
}
- Save and check.
This content originally appeared on DEV Community and was authored by Süleyman Özgür Özarpacı
Süleyman Özgür Özarpacı | Sciencx (2023-05-18T20:48:12+00:00) How to edit Filament Relation Manager Table Query. Retrieved from https://www.scien.cx/2023/05/18/how-to-edit-filament-relation-manager-table-query/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.