J
J
jallvar2020-11-12 14:16:48
Laravel
jallvar, 2020-11-12 14:16:48

How to apply filters in a model in Laravel?

Hello everyone, I have a table with goods "items"
-id
-name
-shop_id
AND a related many-to-one table "shops"
-id
-name
-delivery
-city
A lookup table "cities"
-id
-name
AND a table with links one-to-one "reference_city"
-id
-shop_id
-city_id
There are the same 2 tables for delivery

The product catalog has fields with filters. Display products by city (city), type of delivery (delivery)
How to search in laravel when all table data is not in one place

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
pLavrenov, 2020-11-12
@jallvar

The question is voluminous and very implementation dependent.
Laravel is a framework, not a CMS, all business logic is done by hand.
You can study the issue in this order:
1. Relationships of models
2. Working with the database
After reading these 2 sections, you can get an understanding of how it can work, and then understand how it is implemented in the current project.

N
N, 2020-11-12
@Fernus

https://laravel.com/docs/8.x/eloquent-relationship...

S
Sergey, 2020-11-14
@Ermak1

Query Builder and Join to help you. Join the tables you need and apply conditions.
https://laravel.com/docs/8.x/queries#joins

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question