Our blog

How to use external classes and PHP files in Laravel Controller?

Laravel is an MVC framework with its own folder structure, but sometimes we want to use something external which doesn’t follow the same structure. Let’s review two different scenarios – when we have external class and when it’s just a .php file.

Tuesday, July 28th, 2015

Most important Laravel people to follow on Twitter

Twitter is probably the best way of getting quick updates on the news and get relevant links to newly published articles, and Laravel community is not an exception – so here’s a list of who to follow.

Monday, July 27th, 2015

Laravel Custom Validation: one of the fields required, but not both

Laravel Validation mechanism has a lot of rules provided – a field can be required, integer, IP address, timezone etc. But sometimes there is a need for a special rule which is not in that list. One example of this is when you have two fields and you need only one of them to be filled. One, or another, but NOT BOTH. Laravel doesn’t have a rule for that, so let’s create one!

Friday, July 24th, 2015

CSRF protection difference: Laravel 4.x, 5.0 and 5.1

For those who work with different Laravel versions on different projects, it’s useful to know the difference of CSRF logic – it changed a little from 4.x to 5.x.

Thursday, July 23rd, 2015

Route Group within a Group

A real-life scenario: you want to have URLs like account/*** under the same Route group with a prefix, but some of them should be also restricted with Auth Middleware. No problem – you can create a Group within a Group!

Wednesday, July 22nd, 2015

View logs with Artisan Tail command in Laravel 5+

If you moved from Laravel 4 to version 5 or 5.x – you will miss an Artisan command artisan tail for your log viewing. How to get it back? Luckily, there’s a package for that.

Tuesday, July 21st, 2015

Eloquent: incrementing columns without update() function

Eloquent mechanism isn’t limited to just create/update/delete functions – that’s why it’s awesome. One of those helpers come to rescue when you need to increment a column, basically run update X set Y=Y+1 where id = Z – apparently, there’s no need to run update() function for that.

Monday, July 20th, 2015

Eloquent: How to make lists() work for Accessor fields?

A very convenient way to populate dropdown options with Eloquent is to use lists() function. But it doesn’t work out of the box with “Append” fields, also called “Accessors”. Here’s a small trick to make it work.

Friday, July 17th, 2015

Schema Builder: changing table columns (only Laravel 5.0+)

While working with database migrations and schema builder, sometimes we do need to make changes to the columns that already exist. Can you do that and how?

Thursday, July 16th, 2015