Multi-select Filter Search in Laravel 4
I need help/guidance in developing a multi-select filter search for my
Laravel 4 app.
I have a table in my database called 'accounts'. This table is linked to
other tables in the database via the following relationships:
'users' via belongs to (User model has a has many relationship to
accounts) 'account_types' via belongs to (AccountType model has a has one
relationship to accounts)
In my view I would like 3 multi-select boxes, company names (taken from
the accounts table 'company_name' field), account managers (taken from the
account_managers table, 'first_name' and 'last_name' fields) and account
type (taken from the account_types table, 'type' field).
When I user selects values from these multi-select boxes and submits the
form, I need to search the relevant tables and bring back the results. I
don't want to use joins for this, as it is very slow. Especially, when
bringing back values for the multi-select boxes.
If possible I would like to use Eloquent relationships in a way that
brings back the results quickly.
I have this working with joins and query strings but it is very slow, up
to 10 to 15 seconds.
I hope someone can help me out with this. Cheers.
No comments:
Post a Comment