This file contains 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
<?php | |
use Doctrine\Common\ClassLoader, | |
Doctrine\ORM\Tools\Setup, | |
Doctrine\ORM\EntityManager; | |
class Doctrine | |
{ | |
public $em; |
This file contains 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
<?php | |
defined('BASEPATH') or exit('No direct script access allowed'); | |
/** | |
* Blade Integration Class | |
* | |
* Classe utilizada para integração entre o CodeIgniter e a Blade Template Engine | |
*/ | |
class Blade | |
{ | |
public function __construct() |
This file contains 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
<?php | |
defined('BASEPATH') OR exit('No direct script access allowed'); | |
?><!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Integrando o Google reCaptcha com CodeIgniter</title> | |
<style type="text/css"> |
This file contains 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
<?php | |
defined('BASEPATH') OR exit('No direct script access allowed'); | |
class Welcome extends CI_Controller { | |
public function index() | |
{ | |
// Define as chaves de acesso à API | |
$dados['siteKey'] = 'SUA_SITE_KEY'; | |
$dados['secretKey'] = 'SUA_SECRET_KEY'; |
This file contains 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
<?php | |
//Configuração inicial | |
$routes->setDefaultNamespace('App\Controllers'); | |
$routes->setDefaultController('Home'); | |
$routes->setDefaultMethod('index'); | |
$routes->setTranslateURIDashes(false); | |
$routes->set404Override(); | |
$routes->setAutoRoute(false); |
This file contains 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
<?php | |
use CodeIgniter\HTTP\Response; | |
$response = new Response(); | |
$response->setStatusCode(Response::HTTP_OK); | |
$response->setBody($output); | |
$response->setHeader('Content-type', 'text/html'); | |
$response->noCache(); |
This file contains 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
<?php | |
use \CodeIgniter\Database\ConnectionInterface; | |
class UserModel extends \CodeIgniter\Model | |
{ | |
protected $table = 'users'; | |
protected $primaryKey = 'id'; | |
protected $returnType = 'array'; |
This file contains 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
<?php | |
use \CodeIgniter\Database\ConnectionInterface; | |
class UserModel | |
{ | |
protected $db; | |
public function __construct(ConnectionInterface &$db) | |
{ |
This file contains 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
<?php | |
/* | |
* Essa função vai responder pela rota /api/usuarios sob o método POST | |
*/ | |
public function index_post() | |
{ | |
// recupera os dados informado no formulário | |
$usuario = $this->post(); | |
// verifica se a foto foi selecionada e faz o processamento |
This file contains 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
<?php | |
/** | |
* Executa o upload da imagem | |
* @param string $input_name nome do campo "file" no formulário | |
* @return array | |
*/ | |
private function UploadImage($input_name) | |
{ | |
// Carrega a biblioteca de upload | |
$this->load->library('upload'); |