April 1, 2020 — Exceptions are really useful when you want to handle some situations which can not be handled gracefully otherwise. So, using exceptions, you can handle certain sceanrios by showing a nice error message. Take the following example for instance.
March 27, 2020 — Have you ever felt the class properties that you’re using in the constructor are essentially repeated multiple times? i.e At the declaration, in the constructor parameters and while doing assignment in the constructor. For instance, take the following example.
March 18, 2020 — If you want to validate request fields in Laravel, you could use
Illuminate\Http\Request’s validate method where you can specify all the fields that you would want to get validated inside controller’s action. You can do it like so.
March 12, 2020 — Artisan commands in Laravel are truly a blessing. I mean you could create just about any files be it controllers, models, middleware, provider by knocking a simple command from the CLI. For instance, if you want to create a model named
Post you could just fire the following command…
March 10, 2020 — Laravel 7 has been a major version that’s been released last week and it comes with the host of features and improvements to the Laravel framework. One of the improvements being the new fluent string operations API. The goal of these API is to provide more flexibility and readablity to the regular string operations in Laravel by chaining array of string manipulation methods.
March 5, 2020 — I’ve discussed about Route Model Bindings of Laravel in length in this article previously. If you’re not aware about the feature, I’d recommend you check that article first and come back here again.
March 2, 2020 — Constructors are a really important part of the class-based object oriented programming. Through constuctors, a newly created objects initialize properties automatically before it is usable. In PHP, a constructor is a method named
__construct(), which the keyword
new automatically calls after creating the object. Constructors can also accept arguments, in which case, when the
new statement is written, you also need to send the constructor arguments for the parameters.
March 1, 2020 — I use PhpStorm for all my projects related to PHP for years now and I can’t imagine myself going back to another IDE. Period. The amount of features it provides for modern PHP developement is impeccable. There are tonnes of features though, so it’s rather overwhelming if you’ve just started using it and you want to learn all at once.
Download my eBook
Follow me everywhere