Skip to content

Instantly share code, notes, and snippets.

Avatar

James Mills jamesmills

View GitHub Profile
View GenerateDropForeignKeyMigration.php
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
class GenerateDropForeignKeyMigration extends Command
{
View composer_repositories_local.txt
// Let's say you have a local package which you want to do some develoment on by including it in another project
/Users/jamesmills/Projects/Packages/larapex-charts
// You can use this one-liner to have composer install it from you local file system
composer config repositories.local '{"type": "path", "url": "/Users/jamesmills/Projects/Packages/larapex-charts"}' --file composer.json
// Which will add this to your composer.json file
"repositories": {
"local": {
"type": "path",
View TreewareCombined.md

Treeware Treeware Treeware (Trees)

Licence

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

View TreewareLaunch.md

January 2020

Anupdated version of this can be found on our Treeware About Us Page.

Treeware Launch

We are proud to announce the launch of Treeware.

We have partnered up with Offset Earth, to plant trees & fund the world’s best climate crisis solutions. We chose Offset Earth because they operate transparently with a minimal service fee, which they use to spread the message through social marketing.

View Treeware.md

Treeware Option One

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

Treeware Option Two

You're free to use this package, but if it makes it to your production environment you are required to buy the world a tree.

It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you support this package and contribute to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

View PostDataDogSeries
$response = (new Client())->post('https://api.datadoghq.com/api/v1/series?api_key=' . config('core.datadog.api_key'),
[
RequestOptions::JSON => [
'series' => [[
'metric' => 'test.metric',
'points' => [
array(365),
array(13456789, 123)
],
// 'type' => 'rate',
View HelperFunctions.php
<?php
if (!function_exists('applicationUrl')) {
/**
* Will return the fully qualified domain name for the correct environment etc
*
* @param string $sub_domain
* @param string $path
* @return string
View FormRequest.php
<?php
namespace App\Http\Requests\Api;
use Illuminate\Http\JsonResponse;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Validation\ValidationException;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Foundation\Http\FormRequest as LaravelFormRequest;
View Makefile
THIS := $(realpath $(lastword $(MAKEFILE_LIST)))
HERE := $(shell dirname $(THIS))
.PHONY: fix lint test
fix:
$(HERE)/vendor/bin/php-cs-fixer fix --config=$(HERE)/.php_cs
lint:
$(HERE)/vendor/bin/php-cs-fixer fix --config=$(HERE)/.php_cs --dry-run