How to use isset() with multiple variables
There is a smart way of using the isset() function in PHP when dealing with several variables. The old-fashioned way: The easiest and smart way to use isset() with multiple variables:
Coursecomp is your starting point for developing and maintaining your web application.
There is a smart way of using the isset() function in PHP when dealing with several variables. The old-fashioned way: The easiest and smart way to use isset() with multiple variables:
Pingback is a WordPress feature that automatically notifies other WordPress blogs that you have linked to them. This is done by sending a pingback XML-RPC request to the other blog’s pingback URL. If the other blog accepts pingbacks, it will display a link to your post. Pingbacks can help build backlinks, raise your domain authority […]
To get your latest posts ordered by year, you can use groupBy in your query. See the example below:
Laravel tip: if you want to send emails having user uploaded files attached, you don’t need to save the file first. Instead, you just attach the uploaded file with attachData method and that’s it! Here is the example from a Mailable class: Via @ecrmnn.
Quick tip: you can use a pretty handy Eloquent method called whereColumn() to verify if columns are equal. For example, you can find posts that have been updated or posts which have the same title and slug. Here is the code: Read more in the official documentation here.
Since Laravel 9.16 we can reduce the code a bit, using withWhereHas() method. It’s time to do some code clean up! See the example below: As Laravel contributor Eusonlito describes: There are a lot of times that we need to load a relationship using with with the same conditions that we use for whereHas. This method simplifies this […]
Sometimes it’s necessary to add more values to the form request after it has been validated. These values get returned in this method even though they were not part of the request. For this, we can use the method validated() in our form request and merge the original request data with our custom data. In […]
Eloquent collections are one of the most powerful tools in the Laravel toolbox. They give you a fluent, convenient wrapper for complex SQL queries. You can chain together different conditions to create complex queries and then call methods on the resulting collection to fetch your data. And here comes the trap. For example, you filter […]
Hello, guys! Did you know that you don’t have to wrap your Eloquent query with dd() method, and just simple can add it at the end of the query? See how simple it is. How to use dd() in Laravel What is dd() in Laravel? Dump and Die, or dd(), is a Laravel helper function […]
Sometimes, it is necessary to add some styling to your Tailwindcss .prose class. You can do that in two ways. The first one is obvious: you add some additional CSS classes. Imagine you need to change your headings and paragraphs text to black color. Then, you suddenly realize that also you have to change your […]