Back Button Laravel

Hands On: Community Contributions

In this mini-series, we'll, from scratch, allow users to register, submit community articles and tutorials, and then vote on their favorites. Exactly like what we have here at Laracasts! While there are a number of moving parts, it should all make perfect sense, once we're done.

Intermediate
Difficulty
13 episodes
2:19:14 hrs
Start Series

Hands On: Community Contributions

In this mini-series, we'll, from scratch, allow users to register, submit community articles and tutorials, and then vote on their favorites. Exactly like what we have here at Laracasts! While there are a number of moving parts, it should all make perfect sense, once we're done.

  • Latest Episode: Most Recent or Most Popular

  • Like this series? Share the love!

  • 01

    Episode 1 Run Time 7:25

    To begin, we'll need to setup our initial database structure. This way, we can store community links, and associate them with any number of channels/categories. While we're here, we'll also set up a quick registration system. Luckily, because we have Laravel, that only takes a moment.

  • 02

    Episode 2 Run Time 8:38

    Let's figure out how to render a list of community links on the page. This will require us to prepare some dummy data using database factories.

  • 03

    Episode 3 Run Time 8:40

    Our next step is to add a form to the page, which allows a logged-in user to contribute any link to the list.

  • 04

    Episode 4 Run Time 5:14

    We're not quite done with the contribution form just yet. Let's write some validation code, and display the errors in the form.

  • 05

    Episode 5 Run Time 13:49

    Up until now, we've used placeholders for anything related to the assigned channel for each community link. Let's fix that in this lesson. We'll need to populate the channels table, display them within a select element, and then update our validation code to ensure that we only allow valid channel ids.

  • 06

    Episode 6 Run Time 9:26

    We initially decided that all submitted links should be approved; however, that's not reflected anywhere on the site just yet. Let's update our code, so that it only fetches approved links. Next, we'll update the users table to add a new trusted column. This will indicate whether or not we should automatically approve submissions.

  • 07

    Episode 7 Run Time 7:40

    In the last video, we realized that some form of flash messaging will be needed. Let's tackle that in this lesson. While Laravel offer session flashing out of the box, we'll pull in a small little package to expedite the whole process. This will also make preparing modals much simpler.

  • 08

    Episode 8 Run Time 18:28

    How should we handle the situation where a person attempts to submit a link that has been previously shared by somebody else? Rather than allowing or preventing duplicate links entirely, let's instead touch the timestamps of the old submission. That way, it will jump back to the top of the page. In the process of implementing this, we'll discuss and review exceptions and form objects.

  • 09

    Episode 9 Run Time 10:35

    We'll tackle two things in this lesson. First, we'll clean our views up a bit and render the proper pagination links. Next, we'll figure out how to sort all of the links, according to their category. This will allow for easy filtering.

  • 10

    Episode 10 Run Time 10:34

    We're making good progress, but we haven't yet begun working on the voting functionality. This is what allows users to vote on articles that they like. It'll take a couple lessons to knock out, but let's get started with the basic structure.

  • 11

    Episode 11 Run Time 18:44

    We're still working on the voting functionality, so let's get back into it in this lesson. We'll set up the necessary endpoints, create a form, and then refactor our existing logic just a bit.

  • 12

    Episode 12 Run Time 15:02

    Let's update our query to allow for sorting the results by the votes relationship count. As you'll see, we'll need to expand our main Eloquent query quite a bit. We'll even extract it to its own dedicated query object.

  • 13

    Episode 13 Run Time 4:59

    We now have the ability to sort according to popularity, so the only remaining step is to offer the user tabs to switch between sorting options. While we're here, we'll also refactor our initial database query a bit.

    View the source code for this series on GitHub.