raygun's avatar

Should I have a model for each nav link topic? is that how it's done

Should I have a model for each nav link topic? is that how it's done? For instance, I have a blog with News and Video links in the nav bar. I know I can set it up how I want, but I'm new and was wondering is there any conventions to how a site should be set up. Should my News and Videos go in the same table or do they each get there own controllers and models. also if they were to be separate, how would I structure the the two tables so that I could search both using a sitewide search of them? something like this:

$results = DB::table('users')
            ->join('videos',)

I know that's not even close but I'm seeking advice. and any advice would be magnificent

p.s. would pagination work properly using two different tables?

0 likes
4 replies
raygun's avatar

@deltasolutions thanks for thge reply, could you show me an example of how to write the code. I can't really grasp it the way they present it in the docs. looked for video tuts and even examples but they all use just one database

zachleigh's avatar

Models generally describe data and are used to interact with that data. You should usually have one model per database table. There is really no connection between models and nav links. Its entirely possible to have a nav bar, even a site, and have no models if that site doesnt use a database.

As far as putting News and Videos in one table, thats a design decision you have to make based on how you intend to use the content and the relationships between the news items and videos.

Please or to participate in this conversation.