How Do I
It's cool, we all hit road blocks from time to time. Have a web-related question that could be solved in ten minutes or less as a video? If so, tweet @laracasts, hash #helpMeLaracasts, and cross your fingers! You just might see your answer in this series.
Progress
Series Info
- Episodes
- 25
- Run Time
- 5h 33m
- Difficulty
- Intermediate
- Last Updated
- Oct 22, 2019
- Version
- Latest
Series Episodes
- Episodes (25)
How Do I Restrict Access With Nginx
The very first #helpMeLaracasts question in this series comes from Mohammad, via email. He'd like to know how to restrict access to his website on the server level, using Nginx. Maybe his code has been pushed to production, but he's not quite ready to let the public see it. Okay, let's figure out what to do!How Do I Distribute an NPM Package Written With ES2015
Today's question is locked on the Node world. Imagine that you're building an NPM package, but are hoping to use the latest and greatest that ES2015 has to offer. Is it possible to use all these modern features, while ultimately distributing a compiled version to all users? Of course! I'll show you how.How Do I Use Iterators
"Iterator" is a scary term, but it's not so hard to understand. You already know that you can iterate (withforeach) over an array. But what about things which are not arrays? Maybe you're dealing with a collection class, or a file reader, or a database query. How do we iterate over these sorts of things? Well, easily!How Should I Name My Events and Listeners?
This episode's question comes via email. Everybody names their event listeners differently. Let's talk about it, as I offer one approach that you might consider. Don't add the Listener suffix to your class names; instead, name them in exactly the way that you would speak of them. Thanks so much to Sarah Mallicote for the question. If the rest of you have any questions that could be answered in video-form, tweet your question and add the hash tag, #helpMeLaracasts.How Do I Unit Test Eloquent Models?
So how are you supposed to unit test Eloquent models again? You're not the first person to ask this question. The answer is, well, you don't! In this lesson, I'll demonstrate exactly how I go about it.Help Me Understand CSRF
It's possible that the extent of your CSRF (Cross-Site Request Forgery) knowledge equates to, "If I add a call tocsrf_field()in my forms, Laravel keeps me safe from bad guys." And that's fine; you're not wrong! However, if you'd like to really dig in to see how all the pieces fit together, and why we must protect ourselves from this sort of attack, here is the video for you.How Do I Fetch the Most Recent Reply's Username
So you have a single post model, and you want to fetch the username of the most recently published comment. How exactly do we do that? Well, I'll show you a few techniques you might use, ranging from adding ahasOnerelationship, to leveraging the law of demeter, to applying simple joins.Help Me Understand When to Use Polymorphic Relations
Polymorphic relations are a tricky thing. When exactly should we reach for them again?How Do I Create Nested Comments
In this episode, I'll demonstrate how to create nested comments, much like you'd find on Reddit or Disqus. This will give us a good excuse to review a wide variety of Eloquent and collection techniques that you can tuck into your daily workflow.How Do I Sort Tags By Letter
Thanks so much to Phillip for the question. If the rest of you have any questions that could be answered in video-form, tweet your question and add the hash tag, #helpMeLaracasts.How Do I Dry Up My Forms
View the source for this lesson on GitHub.How Do I Automatically Resize Textareas to Fit Their Contents
Imagine that you have a forum, and need to dynamically resizetextareas to fit the length of each user's reply. That way, should they need to edit their reply, they won't have to manually expand thetextareato view their long comment. For things such as this, I like to use a package, called autosize. I'll show you how; it's easy!How Do I Create A Snippets App: Part 1
Over the next two episodes, we'll build a primitive code snippets application that allows users to "fork" existing snippets, and then expand upon them. We'll also set up the necessary functionality to track and list all forks for a given snippet.How Do I Create A Snippets App: Part 2
In this second part, we'll first implement the necessary functionality to allow users to "fork" existing snippets. Then, we'll apply syntax highlighting (using highlight.js), and wrap up our project. View the source for this two-part lesson on GitHub.How Do I Convert Switch Statements to Polymorphism
Today's topic comes courtesy of Diaz, who asks, "How do I convert messy switch statements to use polymorphism and factories?"How Do I Reference Objects Like Arrays
From time to time, you may find yourself in the position of needing to interact with an object's data as if it's an array. The solution is to implement PHP'sArrayAccessinterface. I'll show you how in this episode.How Do I Impersonate Users
In this episode, we'll review how to impersonate users in your application. From time to time, you'll find that it's useful to have the ability to see a particular error or issue exactly as the user does. We'll review the basic implementation, as well as how to test and secure this very sensitive route.How to Cleanly Refactor Loops
In this episode, we'll review a few collection-based refactoring steps, for iterating over a particular list of data. We'll begin with the common approach, and then slowly tweak things, bit by bit, to improve readability.How Do I Make One Interface Fit Another
From time to time, you'll find yourself in the position of needing to adapt one interface - that you don't control - to fit another. Adapt is the keyword in that sentence. In this episode, you'll learn how to use the adapter pattern to solve this common problem.Contribute to Laravel: From Start to PR
Those who regularly contribute to open source projects may forget that getting started with your first PR can be incredibly confusing? Where do you even start? Fork? PR? Huh?How Do I Create Laravel Macros
If you hunt around the Laravel framework source code, you'll find frequent references to a trait calledMacroable. This allows you to dynamically extend the surface area of a given class. In this lesson, I'll demonstrate how to create your own macros, and review how everything is wired behind the scenes to make this particular functionality possible.How Do I Create a Star-Rating System: Part 1
A user on the Laracasts forum recently requested help creating a star-rating system. You've surely seen these many times: choose from one to five stars, and your score will be included in the overall average rating. Let's learn how to build such a component over the next two episodes. We'll start on the backend by fleshing out our desired API.How Do I Create a Star-Rating System: Part 2
View the source code for this episode on GitHub.How Do I Create a Star-Rating System: Part 3
With the backend portion tested and ready to go, the only remaining step is to switch to the frontend. In this lesson, we'll build astar-ratingVue component that submits an AJAX request to the server each time the user chooses a rating of 1-5.How Do I Make a Floating Nav Bar
You've surely seen this functionality all over the web: you scroll the page a bit, and suddenly the navigation bar slides back into view and "stickies" itself to the top of the page. We can use anIntersectionObserverto make a similar effect. This JavaScript API allows us to pass a callback function that will be triggered each time a target element intersects the root viewport. In this lesson, I'll show you exactly how to code it up.
