/**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $pessoas = Pessoa::all();
     $tiposContratos = ContratacaoTipo::all();
     $tiposClasses = ContratacaoClasse::all();
     $tiposCargos = ContratacaoCargo::all();
     $tiposDisciplinas = ContratacaoDisciplina::all();
     return View::make('contratos.create', compact('pessoas', 'tiposContratos', 'tiposClasses', 'tiposCargos', 'tiposDisciplinas'));
 }
<?php

require '../vendor/autoload.php';
require 'bootEloquent.php';
use Slim\Views\PhpRenderer;
$app = new \Slim\App(['settings' => ['displayErrorDetails' => true]]);
$container = $app->getContainer();
$container['view'] = new PhpRenderer(__DIR__ . '/../views/');
$app->get('/', function ($request, $response, $args) {
    return $this->view->render($response, 'hello.php', ['pessoas' => Pessoa::all()]);
});
$app->post('/pessoas', function ($request, $response, $args) {
    $pessoa = new Pessoa();
    $pessoa->nome = $request->getParam('nome');
    $pessoa->save();
    return $response->withRedirect('/');
});
$app->run();
예제 #3
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $pessoas = $this->pessoa->all();
     return View::make('pessoas.index', compact('pessoas'));
 }
<?php

require __DIR__ . '/database/bootEloquent.php';
Flight::set('flight.views.path', __DIR__ . '/views');
// routes
Flight::route('/', function () {
    Flight::render('hello.php', ['pessoas' => Pessoa::all()]);
});
Flight::route('POST /pessoas', function () {
    $pessoa = new Pessoa();
    $pessoa->nome = Flight::request()->data['nome'];
    $pessoa->save();
    Flight::redirect('/');
});
Flight::start();
예제 #5
0
 public function getIndex()
 {
     $usuario = Pessoa::all();
     return View::make('lista-user', compact('usuario'));
 }