Laravel Eloquent: MongoDB relations

Laravel MongoDB

Laravel offers very complex Eloquent – ORM simple to use, but with a lot of options. One of them is relations support. We can define several types of relations between our models and then use them to simplify get the data. Relations are also support by MongoDB extension for Eloquent, which is available on GitHub. Sometimes it may be difficult to use because of some issues with ObjectId and BSON. Let’s see how it can be solved.

Continue reading “Laravel Eloquent: MongoDB relations”

Create development environment on MacOS using Homebrew

I prefer MacOS to develop, because it’s much more stable than Windows 10 – last issues with October update are the best evidence, that something is not ok with this OS development. It’s similar to Linux in many ways, but not exactly Linux like Debian, Ubuntu, RHEL etc. In effect, we can’t just use build-in repositories to install some required software, services and servers. But there is very nice option called Homebrew. Using this, we can make MacOS even closer to Linux system and configuration will be simpler.

Continue reading “Create development environment on MacOS using Homebrew”

PHP: anonymous functions, lambdas and closures

Three months ago I wrote post about arrow functions in JavaScript. It’s very nice feature, that can help write code faster and also solves “this” keyword range and visibility. This method is available in JavaScript and several other languages. But what about PHP? Unfortunatelly, we can’t use arrow functions in this language, they aren’t supported now (November 2018), there is only a RFC and experimental implementantion. Maybe in next versions… But we can also use anonymous functions, we can also use closures and lambdas. This post is about them.

Continue reading “PHP: anonymous functions, lambdas and closures”

Quick tip: increase PhpStorm memory limit

I use PhpStorm as my standard IDE in work. Why? I think it isn’t necessary to describe all advantages – it’s very good software, appreciated and recommended by many, many developers from whole world. PhpStorm can increase our productivity, we can work very fast with code inspection, integrated version control, debugging, testing and many, many other things. But PhpStorm is not perfect. It can be slow if we work with bad or low quality code – mix of not only PHP but also HTML, CSS and JavaScript in one file. With active default inspections and a lot of lines, it can be slooow and require more memory.

Continue reading “Quick tip: increase PhpStorm memory limit”