Skip to content

Instantly share code, notes, and snippets.

View pascalschwientek's full-sized avatar

Pascal Schwientek pascalschwientek

View GitHub Profile
@pascalschwientek
pascalschwientek / Presentable.php
Created August 7, 2016 03:48
Laravel Presenter
<?php
trait Presentable
{
/**
* @var mixed
*/
protected $presenterInstance;
/**
@pascalschwientek
pascalschwientek / index.php
Last active July 30, 2016 00:43
Nasty Foreach
<?php
// Context:
// we have a list of "content owners" (simply an account that can manage content on a third party website) in our database
// a cronjob will sync them. it will add new ones and notify about unavlaibale ones. we can not simply remove unablibale ones
// from the database.
// to get all unavliabel content owners we all avalibale content owners from the api and all content owners from our database.
// and then we execute the nastiest foreach chain on earth to filter out the ones in our db that are not present in the api as
// avalibale.
if (!function_exists('set_active')) {
/**
* Set active class if request is in path.
*
* @param string $path
* @param array $classes
* @param string $active
*
* @return string
*/
/**
* larail.js
*
* Perform a DELETE or PUT request outside a form with a simple link
* and some data-type attributes. For use with Laravel PHP framework.
*
* Step 1: For CSRF-Support you have to put in your <head> section:
* <meta name="csrf-token" content="{{ csrf_token() }}">
*
* Step 2: Simply build a link like this: