A cheat sheet for Laravel’s Eloquent ORM version 5.5.

One to One Relationship

In this demo we have 2 models (Owner and Car), and 2 tables (owners and cars).

The Owner can own one Car.
The Car can be owned by one Owner.

First let’s start with why design patterns exist! Developers have noticed that they seemed to be approaching problems in similar ways in a bunch of different software’s, then they decided that it would be pretty useful to be able to talk about those approaches using a common vocabulary, so they wouldn’t have to keep explaining what they were referring to. Thus they figured out general versions of these common practices and gave them names like “Adapter” and “Singleton.”

A design pattern is only a description or template for how to solve a problem! that can be used in many different…

It’s never been easier for me and for anyone in the community to build and share PHP Packages.

This is all thanks to the great tools and developers: Composer, Packagist, Github, The PHP League, Aura for PHP, PHP-FIG, The Checklist, Laravel, Symfony, NextPack and many other great stuff.

In this article, I will show you how I build my PHP packages really quick.

I’ll start by listing my steps for developing a modern PHP package:


These steps are required by almost every modern PHP package:

  1. Create the Skeleton (5 min)
  2. Setup Git (5 min)
  3. Setup Composer (5 min)
  4. Setup PHPUnit…

Hi again, in this article I will share with you some aspects I keep in mind when building an API, in the hope of helping you build a better API.

1. URL

First thing you need to understand and definitely consider when designing your API, is REST “Representational State Transfer” the ‘standard’ design architecture for building APIs.

The key principles of REST involve separating your API into logical resources. And these resources can be manipulated using HTTP requests where the method (GET, POST, PUT, DELETE, PATCH) has specific meaning.

RESTful principles have gained a wide adoption lately.

Example of RESTful API Endpoints…

So you want to try Docker with your next Laravel project! You don’t want to waste your time configuring Docker containers. You just want to get up and running quickly like you do with Homestead! Laradock.io makes that possible.

Docker VS Vagrant

To build and run a web application, you need to install few software’s/tools and configure them. You can, of course, install those software’s and tools manually on your machine (your own operating system). But this can lead to some troubles! and has some limitations, such as reinstalling everything whenever you change your development machine (computer, laptop), switching between software versions, using the same port for two different software’s, sharing the application with other people when you have made some special configurations to the environment, etc…

The solution to all of the mentioned troubles would be to ship the development environment…

Mahmoud Zalt

★ Software Engineer & More! ★ http://zalt.me

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store