Laravel Eloquent is awesome - probably I don't need to tell you that. What is less known is the list of methods to work with Eloquent Collections. You can filter them, slice them, easily modify etc. But let's look at it one by one.
Laravel 5 version got us confused by separating our beloved Form::open world into a separate package. Now you have to add "illuminate/html": "~5.0" to your projects, whenever you want to use forms, right? Not necessary, you can survive without it.
So you want to create your own package? Surprisingly, this topic has little information online and not properly described in the official docs. Let's fill in the gaps and create a new Laravel 5 package from scratch.
Today I want to talk about a feature of Laravel which is really useful but can be potentially difficult to understand at first. Pivot table is an example of intermediate table with relationships between two other "main" tables.
Quite often in bigger projects there are DB relationships with more than one level: categories->companies->products, countries->teams->players and similar. If we need to get the list of a deeper level, there's a quick way of doing that with Eloquent.
One of less-known but useful Eloquent functions are scopes - basically, you can define conditions to be re-used in various other places in code. Here's an overview.
Another great news for Laravel community - more and more often repeated functions become a part of Laravel framework itself. Today a new addition is Authorization or ACL functionality.
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.
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.
There is one annoying thing in Laravel RESTful approach - if you want to have Edit/Delete links in your tables, Edit is done easy with a link to URL, but for Delete you have to build the whole form. Is there a way to avoid it?