Skip to content

Instantly share code, notes, and snippets.

View adamgoose's full-sized avatar

Adam Engebretson adamgoose

View GitHub Profile
@adamgoose
adamgoose / ApiController.php
Last active April 26, 2016 22:34
IoC Container Tutorail
<?php namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Facades\Textify;
class ApiController extends Controller {
public function postSendSms(Request $request, Textify $textify) {
$this->validate($request, [
'number' => 'required',
.tight-grid .container {
margin-right: auto;
margin-left: auto;
padding-left: 5px;
padding-right: 5px;
}
@media (min-width: 768px) {
.tight-grid .container {
width: 730px;
}
@adamgoose
adamgoose / docker-compose.yml
Created February 24, 2016 23:59
Sentry Docker Config
SentryPostgres:
environment:
POSTGRES_PASSWORD: 'some_db_pw'
POSTGRES_USER: sentry
PGDATA: /var/lib/postgresql/data/pgdata
labels:
io.rancher.container.pull_image: always
tty: true
image: postgres
volumes:
<?php namespace BridgeConX\Support\Traits;
use Carbon\Carbon;
trait HasDateOrTimeColumns {
/**
* Set the attribute - checking for date/time columns
*
* @param string $key
@adamgoose
adamgoose / readme.md
Created January 10, 2015 00:20
BridgeConX Plugin Documentation

BridgeConX Plugins

Creating a new BridgeConX Plugin will involve you cloning this repository, and committing it to a new one with a proper name. All BridgeConX plugins must be named plugin-{PLUGIN_NAME}.

Setting up composer.json

  1. Edit the name property. Change "template" to your package name.
  2. Update the description property.
  3. Feel free to add yourself as an author.
  4. Update the namespace under autoload.psr-4 to reflect your plugin's namespace. For example, if you are writing a YouTube plugin, you may namespace it BridgeConX\\YouTube\\.
@adamgoose
adamgoose / readme.md
Last active August 29, 2015 14:10 — forked from anonymous/readme.md

TMM.io

Translating Models

The package at https://github.com/dimsav/laravel-translatable is installed. In order to translate particular fields on an existing model, follow the steps below.

Setting up the Database and Eloquent

If you are creating a translatable model for the first time, do not add the translatable columns to the parent model's migration or model. They will be handled through the Translation Model. Hopefully the instructions here will clarify this a bit.

Exception in template helper: ReferenceError: Favorites is not defined
at Object.<anonymous> (http://localhost:3000/client/scripts.js?f46fcb6cb38e813b03078ad515119ca34f8b69c2:32:23)
at http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:2693:16
at http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:1602:16
at Object.Spacebars.dot (http://localhost:3000/packages/spacebars.js?3c496d2950151d744a8574297b46d2763a123bdf:231:13)
at http://localhost:3000/client/Business/template.template.js?00b6bc819970cb1f635a29323f34f33bf38a161e:25:51
at null.<anonymous> (http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:2454:44)
at http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:1795:16
at Object.Blaze._withCurrentView (http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:2029:12)
at viewAutorun (http://localhost:3000/packages/blaze.js?77c0809654ee
Template.registerHelper('favorites', function()
{
var favorites = new Favorites();
favorites.init();
return favorites;
});
# SPA API Authentication
> Just a note, I did NOT test these code snippets at all. If you have issues, let me know.
## Some Considerations
1. jQuery's AJAX calls do not maintain a session, thus typical Laravel Authentication will not work for your API.
2. Every time your API, you will need to tell it who you are!
3. In my opinion, your API should ONLY serve up content that belongs to the authenticated user. See #7 in the approach workflow below.
<?php namespace TAA\Entities\User;
use Course;
use Illuminate\Database\Eloquent\Collection;
use User;
class AuditHelper {
/**
* @var User