Skip to content

Instantly share code, notes, and snippets.

View geggleto's full-sized avatar

Glenn Eggleton geggleto

View GitHub Profile
<?php
namespace controllers;
/**
* Description of Controller
*
* @author Glenn
*/
class Controller {
<?php
namespace controllers;
/**
* Description of Auth
*
* @author Glenn
*/
class Auth extends \controllers\Controller {
$route = $app->router()->getNamedRoute($route_name);
$route->setParams($param);
ob_start();
$route->dispatch();
$contents = ob_get_clean();
<?php
/* Show all and featured ideas routes */
$app->get('/', 'Idiaz\Action\IdeasBrowseAction:__invoke')->name('ideas');
$app->get('/ideas', 'Idiaz\Action\IdeasFeaturedAction:__invoke')->name('ideas.featured');
/* New idea routes */
$app->get('/ideas/new', 'Idiaz\Action\IdeasCreateAction:__invoke')->name('ideas.create');
$app->post('/ideas/new', 'Idiaz\Action\IdeasStoreAction:__invoke')->name('ideas.store');
/* Show a route */
$app->get('/ideas/:id', 'Idiaz\Action\IdeasShowAction:__invoke')->name('ideas.show');
/* Editing idea routes */
@geggleto
geggleto / gist:8e137724883949752b44
Created April 8, 2015 13:25
autoload-composer slim
"autoload": {
"psr-0": {
"VMS" : "src/"
}
}
Capsule::connection()
->table('jobs')
->join('job_codes', 'jobs.id', '=', 'job_codes.job_id')
->join('codes', 'codes.id', '=', 'job_codes.code_id')
->where('date', '=', $date, 'and')
->where('user_id', '=', $pein)
->select("*");
<?php
namespace VMS\Traits;
trait UserRelationshipTrait {
/**
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function users() {
return $this->hasOne("VMS\Models\User");
@geggleto
geggleto / gist:968e35cc2b3b7a3db7d2
Created April 23, 2015 13:17
htaccess for slim on windows
RewriteEngine On
# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
<?php
class UserTest extends \PHPUnit_Framework_TestCase {
/**
*
* @var GuzzleHttp\Client
*/
private $client;
public function setUp() {
<?php
namespace Space;
class RouteManager {
public function __construct() {
$app = \Slim\Slim::getInstance();
$app->get('/', function () {
print "hi";
});