Skip to content

Instantly share code, notes, and snippets.

@davedevelopment
Created May 14, 2013 12:37
Show Gist options
  • Save davedevelopment/5575571 to your computer and use it in GitHub Desktop.
Save davedevelopment/5575571 to your computer and use it in GitHub Desktop.
$app['repository.factory'] = $app->protect(function($class) use ($app) {
return $app->share(function ($app) use ($class) {
return new $class($app['db']);
});
});
$app['users'] = $app['repository.factory']("User");
$app['groups'] = $app['repository.factory']("Groups");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment