Created
January 16, 2017 04:53
-
-
Save bradcypert/9b7b3020f19be50c216d8f7989d870ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require '../vendor/autoload.php'; | |
require '../src/models/dev.php'; | |
$container = new \Slim\Container; | |
$container['db'] = function ($container) { | |
$capsule = new \Illuminate\Database\Capsule\Manager; | |
$capsule->addConnection($container['settings']['db']); | |
$capsule->setAsGlobal(); | |
$capsule->bootEloquent(); | |
return $capsule; | |
}; | |
$app = new \Slim\App($container); | |
$app->get('/dev/', function($request, $response) { | |
echo $this->db; | |
return $response->getBody()->write(Dev::all()); | |
})->setName('devs'); | |
$app->get('/dev/{id}/', function($request, $response, $args) { | |
$id = $args['id']; | |
$response->getBody()->write($id); | |
return $response; | |
})->setName('dev'); | |
$app->post('/dev/', function($request, $response, $args) { | |
}); | |
$app->delete('/dev/{id}/', function($request, $response, $args) { | |
}); | |
$app->put('/dev/{id}/', function($request, $response, $args) { | |
}); | |
$app->run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment