Laravel has convenient database migrations mechanism, which allows us to track database changes and easily roll them back if needed. But what is hiding behind the scenes? What if we need to know actual SQL queries that have been generated during the migration? Or another scenario - what if we want to check the SQLs before they are actually run? There's a trick for both of it.
With Laravel, we get used to command line commands like composer install or artisan migrate. But what if we have only shared-hosting from client, with only FTP access and phpMyAdmin to manage database? Laravel is still usable in this case, but there are some tricks you need to make it work.
Today I want to tell you about one "hidden" Laravel feature which is in the system but not in documentation - replicate. This function allows you to make a copy of a row in the fastest way possible.
Laravel comes with out-of-the-box authorization mechanism which is incredibly easy to use. But it depends on several pre-defined things, one of the main ones - DB table **users** structure and login with **email** field. What if you want to have **username** to identify a user?
Did you know that Laravel Auth system allows you to block the user after X bad attempts to log in? Even more, you can change that limit! This trick works with out of the box Laravel Auth system and all you have to do is modify one file.
Today I want to offer you an overview of a package made for DataTables.net integration into Laravel: laravel-datatables. This package allows you to easily create server-side processed DataTables with most of its available functionality while only writing a few lines of code.
Laravel has a great mechanism of migrations, but what if you want to visualize your DB schema to see all in one place - to discuss with colleagues, for example. There is a great tool for that - here's a brief overview of Laravel Schema Designer.
Migrations are a great way of building database schema, but sometimes it's harder to deal with more than just columns. One of more interesting things are indexes. In particular, I had a problem of auto-assigning a name to unique index, which appeared to be too long. What to do with it?
Today I want to share a small trick which I've found out only recently. Let's say you need to have a select dropdown field with number range from X to Y - for example, birth year from 1900 to 2015. How would you do it?
When selecting data form the database, sometimes you need to make some extra filtering with results - with some if-else statements and similar. With Laravel - you can achieve that with Accessor fields or just looping through results in PHP. But there is a more effective way - to move the filters to the database query itself.