Coursecomp is your starting point for developing and maintaining your web application.
Hello, friends! You may be don’t know yet, but actually you can make some text transformations (uppercase, lowercase, capitalization) on your translation variables in Laravel. Here is the code:
You can easily cache a database query or any other data in the HTTP requests with Laravel’s Cache facade. The closure function passed to the remember method will be used if the cache doesn’t exist. See the example below:
If you’re receiving errors like "Class Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory not found", you need to know that the app codebase has been impacted by one of the largest changes in Laravel 9, when the development team transitioned from SwiftMailer to Symfony Mailer. Let’s fix the problem. Run this command in your Laravel application folder: Also, don’t forget to […]
If you need to retrieve records between two timestamps, you can use whereBetween method with a from and to date. You can also to provide a fallback with the null coalescing operator (which was implemented in PHP since version 7+). by @ecrmnn
When making changes to a Model and its relations in Laravel, you don’t need to call save() method on each of them. Instead, you just can call push() on the main Model and it will recursively save any changes. by @mattkingshott
In order to show your Github Gist, you need to add a Custom HTML block in your WordPress editor, then paste the javascript embed link that you’ve got from Github. Your WordPress editor area: You can also make sure that everything is OK by switching to Preview option: Enjoy!
In order to replace this html entity, you cannot use the str_replace function in PHP. You should try this code instead: Enjoy!
If you have relationships like hasMany or manyToMany in Laravel and you need to extract data from specific columns of your DB table with your Eloquent query, just do it like that: Don’t forget to always use a column with primary key (in the example above it is id column) and not to put spaces […]
If you need to audit sign in and sign out events for some security concerns, then you can utilize Laravel auth events, which allow you to easily listen for them.
Sometimes you need to change the default text of validation error messages returned when data validation fails. Fortunately, with form requests, you can make our own error messages to make it clearer to the user.