Websockets in Laravel – Part 2: Setting up Comments API & AJAX

We are all anxious to get writing some code to interact with websockets, but first we need to build the foundation of code necessary to start submitting and displaying comments to our users. Once we have this part setup, then we can easily add websockets to it to enhance the experience even more. This episode will create a small API for us to interact with and will create some structure to save our comments. First we need to create a database migration to store our comments. This will require creating a migration, a model, and a controller for our comments. We will make 2 API endpoints for our comments. The first is to display all comments for a specific post. The second endpoint will allow us to save a new comment via the API. Then its time to use this API by setting up our frontend.

It's only fair to share...Tweet about this on TwitterShare on FacebookShare on TumblrShare on Google+Digg thisShare on LinkedInPin on PinterestShare on VKShare on RedditPrint this pageEmail this to someone
Flattr the authorShare on StumbleUponShare on YummlyBuffer this page

Leave a Reply

Your email address will not be published. Required fields are marked *