Support the ongoing development of Laravel.io →
Configuration Database

I and looking to do my own blog to go alongside my new site build but was wonder what people would suggest for a db structure for this blog.

It would have the usual title, body, image, date, tags, slug etc, would you separate some data etc or run it all in one table. As it's for me it's not user based so no need for a user post relation table etc.

I will be looking into using disqus to support the comments so need need for this either.

I was also looking into using markdown for the body, and as new to markdown some notes on this would be good if anyone has a good plugins to compliment laravel etc

Last updated 3 years ago.
0

As a minimum, I suggest create a posts table and use comma separated fields for tags and categories, and blob for the content, and offcourse the datetime, slug and anything else specific to your site.

Last updated 3 years ago.
0

I mostly agree with @rashidshafique above, but I would suggest a text column.

As for markdown, looks like someone has already written a service provider to 4.x:

You should be able to composer install that and have access to it in your controllers / views where needed.

Last updated 3 years ago.
0

much appreciated for the response's. Could you elaborate on the "table and use comma separated fields for tags and categories" i was thinking of a separate tags table with a relationship?

Last updated 3 years ago.
0

I would separate it out and create a 1 to many relationship between posts and categories and a many to many relationship between posts and tags. So you would end up with 4 tables: posts, categories, tags and post_tags.

Check out: http://laravel.com/docs/eloquent#relationships - (note the post_tags linker table is by default derived from the posts model and the tags model in alphabetical order).

http://packalyst.com has some markdown packages.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.