Skip to content

Instantly share code, notes, and snippets.

View andyleach's full-sized avatar

Andrew Leach andyleach

  • Wastequip (StackLogix)
  • Charlotte, NC
View GitHub Profile
dd('daemon.EmailOut.php $skip '. $skip. ' $channel '. $channel);
dd('daemon.WebOut.php $filter '. json_encode($filter));
dd('daemon.Importing.php '. json_encode($filter));
dd('daemon.in.php $inbox '. $inbox);
dd('daemon.database.php');
dd('daemon.Sending.php $lms_ids '. json_encode($lms_ids));
dd('daemon.statusBar.php');
dd('daemon.hourly.php $modulus '. json_encode($modulus));
dd('daemon.maint.php');
dd('daemon.dailyMaint.php');

UsedByTeams Model Trait For Laravel Spark

Automatically limit your models to the current team

So you're using spark, and you have teams enabled. You start creating models and want to have them be team specific. Instead of writing, Model::where('team_id', auth()->user()->currentTeam->id)->get(); use this trait to add that behind the scenes so that every time you call on your model, it's assumed that you mean for the current team.

This assumes that the model has a team_id, while it adds a scope of where team_id = currentTeam->id.

Note: Implicit Route Model Binding in 5.2, auth session doesn't exist at the point of this trait causing issue. fixed in 5.3

@andyleach
andyleach / Contract Killer 3.md
Last active May 17, 2016 20:52 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Between Ambage

And [customer name].

Summary:

We'll always do our best to fulfil your needs and meet your expectations, but it's important to have things written down so that we both know what's what, who should do what and when, and what will happen if something goes wrong. In this contract you won't find any complicated legal terms or long passages of unreadable text. We've no desire to trick you into signing something that you might later regret. What we do want is what's best for both parties, now and in the future.

So in short;

var gulp = require('gulp');
var minifycss = require('gulp-minify-css');
var autoprefixer = require('gulp-autoprefixer');
var notify = require('gulp-notify');
var sass = require('gulp-ruby-sass');
gulp.task('css', function() {
return gulp.src('sass/main.sass')
.pipe(sass({ style: 'compressed' }))
.pipe(autoprefixer('last 15 version'))
@andyleach
andyleach / functions.php
Last active January 13, 2017 08:17
WooCommerce Product Category Swatches
<?php
function display_product_colors() {
$colors = array();
$options = get_post_meta(get_the_ID(), '_swatch_type_options', true);
foreach($options as $option) {
foreach($option as $item) {
foreach($item as $att) {
$colors[] = $att['color'];
}