Laravel Many to Many Relationship Tutorial

Many To Many (e.g. User can win multiple Trophies and each trophy can belong to many Users) Steps 1 — Models classes and Tables2 — Migrations3 — Defining Relationships in Modal classes4 — Fetch/Create/Update/Delete Records Models classes and Tables 1- User Model and users table2- Trophy Model and trophies table3- trophies_users pivot table Migrations Run below command in the console to create model and table php artisan make:model User -m //create users table and User Read more

Install composer packages from private repository from GitLab

I had to install a PHP package that’s not hosted on packagist. Rather, it stays under my organization’s private repository on Gitlab. So, I thought to write an article that can be easy for others if they’re going through the same. So, to install a package from GitLab which is not a public repository will need a Personal Access Token. You can issue your PAT by going to Profile Icon > Settings > Access Token. Read more

How to change the commit author for one specific commit?

Interactive rebase off of a point earlier in the history than the commit you need to modify (git rebase -i <earliercommit>). In the list of commits being rebased, change the text from pick to edit next to the hash of the one you want to modify. Then when git prompts you to change the commit, use this: git commit --amend --author="Author Name <email@address.com>" --no-edit For example, if your commit history is A-B-C-D-E-F with F as Read more

Deploying Vault and Consul

Let’s look at how to deploy Hashicorp’s Vault and Consul to DigitalOcean with Docker Swarm. This tutorial assumes that you have a basic working knowledge of using Vault and Consul to manage secrets. Please refer to the Managing Secrets with Vault and Consul tutorial for more info. Upon completion, you will be able to: Provision hosts on DigitalOcean with Docker Machine Configure a Docker Swarm cluster to run on DigitalOcean Run Vault and Consul on Read more

Comparing sizes of protobuf vs json

Google Protobuffer is a binary format claiming to much more compact than json and other text-formats, but just how much less space does it require? Does it hold for large arrays of data? In this blogpost I will compare the sizes of the two formats. Test-data with array of tickers I will generate test-data with a home made tool, you can find it on github: https://github.com/nilsmagnus/protobuf-json-xml-size-comparison The content of the data is defined in a Read more

Ansible wait_for with docker_container

When using Ansible’sdocker_container to manage containers, we’ve seen people use wait_for ensure the container is started. This requires that the container exposes a port and typically on the host network. Then the IP and the exposed/published port can be used to verify the container (or the service inside) is running. What if there is no port, or no host binding? If there is nothing to expose from the container (e.g. think of a queue worker), Read more

How to Configure the Linux Firewall for Docker Swarm on Ubuntu 16.04

Docker Swarm is a feature of Docker that makes it easy to run Docker hosts and containers at scale. A Docker Swarm, or Docker cluster, is made up of one or more Dockerized hosts that function as manager nodes, and any number of worker nodes. Setting up such a system requires careful manipulation of the Linux firewall. The network ports required for a Docker Swarm to function correctly are: TCP port 2376 for secure Docker Read more

How can I make git accept a self signed certificate?

To permanently accept a specific certificate Try http.sslCAPath or http.sslCAInfo. Adam Spiers’s answer gives some great examples. This is the most secure solution to the question. To disable TLS/SSL verification for a single git command try passing -c to git with the proper config variable, or use Flow’s answer: git -c http.sslVerify=false clone https://example.com/path/to/git To disable SSL verification for a specific repository It is possible to globally deactivate ssl verification. It is highly recommended to Read more

Building Driver-based Components in Laravel

Componentization is a great way to build extensible and reliable software systems. It allows us to build large systems that are composed of decoupled, independent and reusable components. It gives us a plug-and-play approach to building software systems. Laravel as a framework is richly composed of reusable components — some of which are third-party Symfony components — that are all well-defined and pieced together to make up the system. Components Most modern software systems are Read more

Laravel: The hidden Manager class

When creating your application, sometimes you may find a class that accepts different implementations of something. For example, a delivery courier may need any transportation to reach your house with your package: bicycle, car, or even public transport. Okay, you get the picture. Now you need a way to create these implementations depending on what the delivery courier needs to use to reach your house. And each of these implementations of transport have their own Read more


Любишь мемасики?

Подпишись на мой телеграм-канал!

Открыть
Закрыть