Skip to content

Instantly share code, notes, and snippets.

Vitor Faiante vitorf7

View GitHub Profile
@vitorf7
vitorf7 / binder.php
Created Aug 14, 2019 — forked from arodbits/binder.php
Combine binding values into a raw SQL query in Laravel. Debugging in Laravel.
View binder.php
<?php
//example:
$query = Foo::where('id', '=', 1)->where('name', '=', 'bar');
//would produce the following raw query:
//select * from foo where id = ? and name = ?;
dd(vsprintf(str_replace('?', '%s', $query->toSql()), collect($query->getBindings())->map(function($binding){
return is_numeric($binding) ? $binding : "'{$binding}'";
@vitorf7
vitorf7 / docker-remove-all.sh
Created Mar 7, 2018 — forked from ericmdev/docker-remove-all.sh
Docker - stop and remove all containers and images.
View docker-remove-all.sh
#!/bin/bash
# Stop all containers.
docker stop $(docker ps -a -q)
# Delete all containers.
docker rm $(docker ps -a -q)
# Delete all images.
docker rmi --force $(docker images -q)
You can’t perform that action at this time.