How To Structure Database

so I have a question that's needs urgent attention

I have a project at hand I was asked to create an exchange platform (escrow) where a user can post and offer regarding the location they are coming from and where they are going to. interested user can filter this offer by there locations

it's works like this a user post an offer the user select location from & to

then those in search can filter offer by location from & to

how can I structure this kind of table



Welcome to the Codecourse forum!

I'm not quite understanding your post, but I recommend having a good read of the Laravel documentation. It might also be a good idea to show what you have tried and share some code.

There is a whole course on relationships from Codecourse, as well as one for filtering.

Taking a stab in the dark, I am guessing you'd want to do set something like this up:

locations migration

        Schema::create('locations', function (Blueprint $table) {

User model

    public function locations()
        return $this->hasMany(Location::class);

You can then build up a query to filter using these columns.

Without a more detailed explanation and code samples, it's really hard to understand what you want to help you further. These should point you in the right direction to get you started.

UPDATE: Reading your post again, you may want to have the relationship on your Offer model instead. Ideally, if users have locations too, you can setup a polymorphic relationship.