پی اچ پی

روش ها

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.

سطح متوسط 25 جلسه آموزشی 05:33:00 ساعت
01
قسمت 1

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 t...

02
قسمت 2

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 compil...

03
قسمت 3

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 (with foreach) 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 datab...

04
قسمت 4

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...

05
قسمت 5

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. Thanks so much to Bart Jacobs for the questio...

06
قسمت 6

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 to csrf_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...

07
قسمت 7

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 a hasOne relationship, to leveraging the la...

08
قسمت 8

Help Me Understand When to Use Polymorphic Relations

Polymorphic relations are a tricky thing. When exactly should we reach for them again? View the source for this lesson on GitHub. Thanks so much to @shahsahebi for the question. If the rest of you have any questions that could be answered in vide...

09
قسمت 9

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. V...

10
قسمت 10

How Do I Sort Tags By Letter

So you'd like to offer a page on your website that allows users to view all tags, organized by letter? No problem; I'll show you how. This will also give us a nice opportunity to a few fun things, including Bulma, CSS columns, and Eloquent collecti...

11
قسمت 11

How Do I Dry Up My Forms

A common gotcha for beginners revolves around re-using forms. It doesn't feel quite right to copy and paste your model's "create" form into the "edit" page, but you're not sure of any other way. For the "edit" form, a couple of things must be diffe...

12
قسمت 12

How Do I Automatically Resize Textareas to Fit Their Contents

Imagine that you have a forum, and need to dynamically resize textareas 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 the textarea to view their long comment. For things suc...

13
قسمت 13

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....

14
قسمت 14

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...

15
قسمت 15

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?"

16
قسمت 16

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's ArrayAccess interface. I'll show you how in this episode.

17
قسمت 17

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 wel...

18
قسمت 18

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. I encourage you to give Re...

19
قسمت 19

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 com...

20
قسمت 20

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? In this episode, from scratch, we'll identify a small patch that we'd lik...

21
قسمت 21

How Do I Create Laravel Macros

If you hunt around the Laravel framework source code, you'll find frequent references to a trait called Macroable. 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...

22
قسمت 22

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 co...

23
قسمت 23

How Do I Create a Star-Rating System: Part 2

Let's now approach things from the outside-in. If I make the appropriate HTTP request to star an article, its average rating should be updated. View the source code for this episode on GitHub.

24
قسمت 24

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 a star-rating Vue component that submits an AJAX request to the server each time the user chooses a rating of 1-5. V...

25
قسمت 25

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 an IntersectionObserver to make a similar effect. This J...

دوره در حال اجرا

این دوره هنوز به پایان نرسیده است و در آینده درس های دیگری به آن افزوده خواهد شد.