Sometimes there is a situation where we have our main project database, but we need to take some external data from another database - for example, where blog is stored, managed by 3rd party software. How to handle it in Laravel 5?
Laravel's Query Builder has a method get() to actually get the rows, but what if we want to get random rows? Like, for example, we have 30 questions in the database, and want to show 10 random ones?
Two-day Laracon US Conference has just finished yesterday, and now it's time to recap all of it. Especially for those who didn't make it to Louisville (like myself), there's a ton of public information about everything that has happened there. Let's dig it all up and try to build a picture.
Migrations are a really useful tool to keep the database structure in sync with all environments and for all team members. And whenever we generate a new migration - its filename has a pattern of date_time_name.php. But what if you need to add a table which was in the database long time ago and created manually? How to add it into migrations folder and specify its time in the past?
Blade templates are mostly for viewing data. But sometimes we do need to add some checks and IF-structures. One of the tricky examples - loop through @foreach but do some action only on first/last element of the array. Blade doesn't have that functions in itself, so what do we do?
Laravel framework comes with built-in Auth mechanism for logging-in and registering users. As a part of that we have starting migration files, one of them is creating a main Auth DB table called users. But what if we want to change that table name, and use Users for some other purpose? It's actually pretty easy to do.
If you follow proper development and deployment process, at some point you have to test your web app with some kind of data. Fake data, preferably. But, on the other hand, "real enough" to test how it would look and work. There's an awesome package for this called Faker.
Let's say you want to filter out entries created today. You have a timestamp field created_at, right? How do you filter the DATE only from that timestamp? Apparently, Taylor thought about it.
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.
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.