Serverside language we use to build magnificent webapplications. With Laravel, a new era for PHP has come. We love to explain our newest insights on Laravel.

Eloquent relations in Laravel

Posted in PHP on July 25, 2016

One of the powerfull features of Laravel are the eloquent relations. They make it easy to retrieve and store relevant information from a database without writing complex queries. In order to use the eloquent relations, one has to correctlty set up the database and define relations in the corresponding models. This blog post explains how to achieve this.

Read more

Accessors and mutators in Laravel

Posted in PHP on May 30, 2016

A common issue when building a webapplication is the case where you want to display variables in a different format than they are stored in your database. For example, dates are by default stored as yyyy-mm-dd, but in the Netherlands dates are written as dd-mm-yyyy. Or maybe you stored the names of your users in lowercase, but you would like to show them with a capital. For those kind of situations, the accessors and mutators of Laravel are of great use.

Read more

Validation of user input with a request in Laravel: authorization

Posted in PHP on May 19, 2016

Validation of user requests is an essential part of every web application. Part of the validation process is a check whether the user input has the correct format. Is the email address entered by the user really an email address? But there is more. We have to make sure that the user who is doing the request, is actually allowed to do this. With the authorization methods of Laravel, it’s easy to set this up.

Read more

Protect your images in Laravel

Posted in PHP on April 18, 2016

For many websites, it’s common to display images that are uploaded by users. Often the images are available to all other visitors of the website, but sometimes you want to protect the image files. For example, you want people to first create an account before they are allowed to view certain content. How can this be achieved in Laravel?

Read more

Laravel’s view composers

Posted in PHP on November 23, 2015

With the view composers of Laravel, it’s easy to extend your master view with dynamic information. For example, your website has a topbar in which you would like to show a message to users that are logged in (welcome firstname lastname) or you want to show the contents of the user’s shopping cart. A view composer provide these possibilities in a very clean way.

Read more

Validation of requests in Laravel

Posted in PHP on November 6, 2015

In most websites or webapplications, users are allowed to fill in some forms of which the data should be stored in a database. For example, if a new order is placed in a webshop, or a new account is created, the data entered by the user should be stored. It’s essential to validate this user input before actually saving it. Laravel has a build-in validator class to make this an easy job.

Read more

Optimizing CRUD operations: inserting data into a database

Posted in PHP on September 25, 2015

In many applications, create-read-update-delete (CRUD) operations are common tasks that are regularly performed. To optimize your workflow and keep your code clean, it is a good idea to generalize these operations. When you build a webapplication from scratch, you likely have written some wrapper functions for this purpose, but when you are using Laravel, a lot of nice features are available out of the box. In this blog, we focus on the creation of new records and the modification of existing ones.

Read more

Namespacing in php

Posted in PHP on August 25, 2015

When an application grows bigger and code gets more involved, chances are that you are accidentally reusing the same function or class name. As a consequence, an error occurs. If you’re using external libraries, you even have a bigger change of creating an error. The solution is to use namespacing and this blog covers an introduction to this topic.

Read more

Passing objects by reference and by value

Posted in PHP on August 5, 2015

When you supply arguments to a function, these arguments will either be passed by value or passed by reference. This seems to be a subtle difference, but it could become a bit frustrating if you don’t know exactly what happens. The key thing to note is that simple variables such as strings, integers and floats are passed by value by default, but objects are passed by reference. If you need to use the object passed by reference, use the clone keyword to make a deep copy!

Read more