Blog System By Laravel

Git hub link

This is a blog project using Laravel. I used Inertia, so that I can use React and Laravel together. This project can be deployed with Docker.

What I implemented are mainly following:
  1. Separate the posts between others' posts and the personal posts. In the personal page, You can edit and delete the posts.
  2. Create a new post as well as a draft post
  3. Make Like feature that is the only feature that uses pivot tables.
  4. Seed the data to the database for testing

1. Separate the posts between others' posts and the personal posts. In the personal page, You can edit and delete the posts.

I wanted to have a feature to have different space for the personal posts and others' posts as lots of SNS have. I make some features for others' page that are you can see a detail of each posts, you can comment and put Like, you can search based of text you enter in search box. In the personal page, You can edit and delete the posts using function as I mentioned section 1.
all-posts image.my-posts image.

2. Create a new post as well as a draft post

I made a feature to create a new post and a draft post. This feature is helped by Inertia form helper useForm a lot. Since I decided to use React for this project, I could make the form to create a new post and a draft post easily by using Inertia form helper using POST method comes from useForm. I also made a feature to edit the post and delete the post, for this purpose I used PUT and DELETE method from useForm. You can see the detail of the feature from Inertia official site.

compose a post image.

3. Make Like feature that is the only feature that uses pivot tables.

This is only thing I used pivot table, which named likes. Setting belongsToMany relation between posts and users models and liking each via likestable, I achieved to make Like feature. Below is example:

4. Seed the data to the database for testing

I was wondering how I can share the sample with team members or other people before knowing seed and factory function Laravel and faker library. Leveraging the function, I knew I can share the sample data with them easily even I can create some users you want to register when launching and image data as well. You can see detail of post below which is made by faker. It was most amazing thing I learned from this project.
detail of a post image.

Conclusion

Through doing this project, I learned a lot of great points Laravel has even though I was overwhelmed at first. Such as Combination of Inertia, Sail environment that makes Docker easier to use, Debug function by dump function, Seeder and Factory function, and so on. You can build this blog system using the instruction of README.md in the github link above.

Back to home.