Quick Tips

update or create Laravel

Use updateOrCreate() to Run Seeds At Any Time

Database seeding is a convenient function, but it is designed to run once, in the beginning of the project. What if later you want to add some new seeder and unable to run db:seed or migrate:fresh cause current data is already important? There's a cure.
Laravel Blade include

Laravel Blade @include: Three Additional “Helpers”

In Blade language there's a simple @include() command, where you just pass the view path as a parameter. But what if you're not 100% sure if that view exists? Or what if you want to make it a dynamic variable? Let's explore the possibilities.
too-many-login-attempts-Laravel

Laravel Too Many Login Attempts: Restrict and Customize

One of the less-known Laravel features is Login throttling. By default, if user tries to log in via default Laravel login form more than 5 times per minute, they will get different error message.
Laravel model binding key

Route Model Binding: How to Change The Key

Laravel has a great feature of binding models by id field. So you can specify edit(User $user) and system would know to find the user from ID in the URL. But what if you want to bind by some other field?
wildcard subdomain Laravel

Wildcard Subdomain in Routes: Assign Subdomain for Every User

In modern multi-tenancy systems, it's pretty popular to give a specific sub-domain for every user or company, like laraveldaily.slack.com. How to handle these subdomains in Laravel routes?

Invokable Controllers with One Specific Action

Sometimes you need to create a controller which doesn't cover all seven resourceful methods, like index(), create(), store() etc. You just need controller which does one thing and you're struggling how to name that method. No more struggle, there's __invoke() method.
Laravel image validation rules

Four Laravel Validation Rules for Images and Photos

Laravel Validation mechanism has a lot of various rules. Let's pick the ones that can be applied to graphical files.

Laravel Group Query Result by Day/Month/Year

Quick tip for those who want to list some events, grouping them by some date value - by day, month, year etc.

How to add new .env variable, so teammates would notice?

A common problem while working in a team is some custom variables needed, when only one person on the team knows that they are needed, and then other people have errors because they don't have that variable. Like API Tokens for 3rd party apps, default values for some function - basically, anything that should be in .env file. So here's an instruction for you, how to put new environment variables correctly, without screwing up teammates work.

Validate Max File Size in Laravel, PHP and Web-Server

I got this question at least a dozen times: "I'm raising my file validation rule in Laravel to 20 MB but still get errors, it doesn't work". So decided to expand on it and explain the reason, and what to do.

STAY CONNECTED

1,652FansLike
4,727FollowersFollow
5,308SubscribersSubscribe

NEWEST VIDEOS

RANDOM ARTICLES