Skip to content

Instantly share code, notes, and snippets.

@vitorf7
vitorf7 / Test.php
Last active August 29, 2015 14:16
Laravel 5 Testing with Authentication using L5 Helper Methods
<?php
// === Inside my ApiTester.php Class. Could be inside the same test class but I use this for methods to test my API === //
/**
* Set Up Method for Tests
*/
public function setUp()
{
parent::setUp();
@vitorf7
vitorf7 / docker-remove-all.sh
Created March 7, 2018 11:53 — forked from ericmdev/docker-remove-all.sh
Docker - stop and remove all containers and images.
#!/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)
@vitorf7
vitorf7 / binder.php
Created August 14, 2019 15:55 — forked from arodbits/binder.php
Combine binding values into a raw SQL query in Laravel. Debugging in Laravel.
<?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}'";