Latest Blogs

Learn about my progress!

Inserting and Updating Related Models in Laravel

The Save Method Eloquent provides convenient methods for adding new models to relationships. For example, perhaps you need to insert a new Comment for a Post model. Instead of manually setting the post_id attribute on the Comment, you may insert the Comment directly from the relationship's save(): $comment = new App\Comment(['message' => 'A new comment.']); $post ...

Logging Request and Response with Controller and Function Name

Logging is one of the most powerful tools in software development. It gives you an idea of what your code is doing. In Laravel handling logs is very easy. When you start a new Laravel project, error and exception handling is already configured for you. The App\Exceptions\Handler class is where all exceptions triggered by your application are logged and then rendered back to the user. I have ...

Triggers in MySQL

A SQL trigger is a set of  SQL statements stored in the database catalog. A SQL trigger is executed or fired whenever an event associated with a table occurs e.g.,  insert, update or delete. A SQL trigger is a special type of stored procedure. It is special because it is not called directly like a stored procedure. The main difference between a trigger and a stored procedure is that a...