Skip to content

Instantly share code, notes, and snippets.

@lagbox
lagbox / AppServiceProvider.php
Last active January 29, 2016 21:36
Extending ResourceRegistrar to allow for 'singular' wildcards and wildcard renaming.
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
@lagbox
lagbox / AuthCheck.php
Created January 14, 2016 08:27
Auth Middleware from filter
<?php
namespace App\Http\Middleware;
use Lang;
use Closure;
class AuthCheck
{
/**
@lagbox
lagbox / ResourceRegistrar.php
Last active May 12, 2016 00:11
ResourceRegistrar with custom wildcards and global wildcard mapping
<?php
namespace Illuminate\Routing;
use Illuminate\Support\Str;
class ResourceRegistrar
{
protected static $wildcardMap = [];
@lagbox
lagbox / SearchableTrait.php
Last active February 26, 2016 11:11
Old Searchable Trait for pulling fields from the schema
<?php
/*
Model trait
Uses:
Model::getDates() // to not search dates
Model::getHidden() // to not search hidden fields
Optional:
var $searchable = [] // set which fields you want searchable
var $unsearchable = [] // set which fields should be unsearchable
@lagbox
lagbox / ResourceRegistrar.php
Created March 5, 2016 22:06
Adding where conditions to resource parameters
<?php
public function register($name, $controller, array $options = [])
{
...
// We need to extract the base resource from the resource name. Nested resources
// are supported in the framework, but we need to know what name to use for a
// place-holder on the route parameters, which should be the base resources.
$base = $this->getResourceWildcard(last(explode('.', $name)));
@lagbox
lagbox / AppServiceProvider.php
Last active March 15, 2016 21:09
Resource Registrar, add a parameter to show routes
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
@lagbox
lagbox / Kernel.php
Last active March 23, 2016 09:46
Use non exception handling pipeline ?
<?php
namespace App\Http;
use Illuminate\Pipeline\Pipeline;
use Illuminate\Support\Facades\Facade;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
@lagbox
lagbox / greeter.coffee
Last active March 29, 2016 03:37
Greeter - laying out ideas
# Description:
# Language based greetings, and laravenewbie nick change welcome message
#
# Commands:
# hubot show greeting for {language}
# hubot I speak {language}
# hubot forget my greeting
# hubot what is my greeting
# hubot greeting
# hubot list languages
@lagbox
lagbox / expires.coffee
Created March 31, 2016 11:55
Expiring Brain Repository
#
# data structure
# {
# key: ...,
# expires_at: ...,
# ...
# }
#
class CacheBrain
@lagbox
lagbox / letsdothis.md
Last active April 27, 2016 10:43
Lets Do This

Has moved to my blog

This has been moved to my blog at asklagbox blog

Letsdothis your first quick laravel app

We are going to make a quick laravel application, including the setup and install.

We will setup the project using the following:

  • Nginx
  • sqlite3