Skip to content

Commit

Permalink
Merge branch 'release/v4.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
tavo1987 committed Oct 10, 2017
2 parents 9713174 + 579a1de commit 3db35ca
Show file tree
Hide file tree
Showing 16 changed files with 208 additions and 59 deletions.
21 changes: 14 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
SITE_URL="http://mini-framework.dev"
PROJECT_PATH=

DB_HOST=localhost
DB_DATABASE=base
DB_USERNAME=name
DB_PASSWORD=xxxxx
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=

SET_TIME_LOCATE=America/Guayaquil

MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=
MAIL_PASSWORD=

SENDGRID_APIKEY=
FROM=digital@company.com
NAME_COMPANY="COMPANY NAME"

MAIL_FROM=digital@company.com
NAME_COMPANY="Company Name"
LEAD_EMAIL_SUBJECT="Thank you for contacting us"
ADMIN_EMAIL_SUBJECT="New Lead"
ADMIN_EMAIL=adminemail@mydomain.com
SITE_URL="http://mydomain.com"

VALIDATOR_LANG=en
VALIDATOR_LANG=es
9 changes: 9 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# Disable index view
Options -Indexes

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]

# Hide .env Files
<Files .env>
Order allow,deny
Deny from all
</Files>
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@ Mini framework para la creación rápida de landing pages en las que se necesite
- Guardar en base de datos a través de eloquent
- Enviar emails a través del api de sendgrid v3
- Laravel mix
- Sistema de rutas
- Sistema de rutas con soporte para pasar parámetros
- Controladores
- Entidadades o Modelos mediante usando eloquent
- Vistas usando el motor de plantillas de twig
- Templates bases para enviar emails
- url amigables mediante `.htaccess`
- Helper de redirecciones
- Helper para convertir un array a una colección mediante laravel collections
- Helper para limpiar inputs
- Helper para mostrar vistas
- Fácil instalación mediante composer
- Simfony var dumper dd($var), dump($var)

## Herramientas y Tecnologías utilizadas

Expand All @@ -38,6 +35,16 @@ Mini framework para la creación rápida de landing pages en las que se necesite
* [Laravel Collections](https://laravel.com/docs/5.3/eloquent-collections)
* [Web font loader](https://github.com/typekit/webfontloader)

## Helpers
* dd()
* dump()
* collect()
* view()
* clean_input()
* cleanRequest()
* redirect()
* parseUrl()

## Requerimientos
- ` "php": ">=5.6.4"`

Expand Down
11 changes: 0 additions & 11 deletions app/Controllers/ErrorController.php

This file was deleted.

15 changes: 12 additions & 3 deletions app/Controllers/LeadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class LeadController extends BaseController
'email' => 'Email',
];


public function store()
{
$errors = $this->validate($_POST, $this->rules, $this->labels);
Expand All @@ -51,10 +50,20 @@ public function store()
if (!$lead->isRegistered($request->email)) {
$lead->save();
}

Email::send($lead->email, getenv('LEAD_EMAIL_SUBJECT'), 'lead', $lead);
Email::send(getenv('ADMIN_EMAIL'), getenv('ADMIN_EMAIL_SUBJECT'), 'admin', $lead);

redirect('thanks');
redirect("thanks/{$lead->name}");
}

/**
* Route params example
* if the path has parameters, the $ response parameter is required as the first method argument
* @param $response
* @param $name
*/
public function search($response, $name)
{
dd($name);
}
}
5 changes: 3 additions & 2 deletions app/Controllers/ThanksController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

class ThanksController
{
public function index()
public function index($response, $name)
{
return view('thanks.twig');
$name = ucfirst($name);
return view('thanks.twig', compact('name'));
}
}
8 changes: 5 additions & 3 deletions app/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

use App\Controllers\HomeController;
use App\Controllers\LeadController;
use App\Controllers\ErrorController;
use App\Controllers\ThanksController;

$app->get('/', [HomeController::class, 'index']);
$app->post('/store', [LeadController::class, 'store']);
$app->get('/error', [ErrorController::class, 'index']);
$app->get('/thanks', [ThanksController::class, 'index']);
$app->get('/lead/{name}', [LeadController::class, 'search']);
$app->get('/error', function (){
return view('error.twig');
});
$app->get('/thanks/{name}', [ThanksController::class, 'index']);

6 changes: 6 additions & 0 deletions bootstrap/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ function view($template, $vars = [])
{
$loader = new Twig_Loader_Filesystem('resources/views/');
$twig = new Twig_Environment($loader);
$twig->addGlobal('siteUrl', getenv('SITE_URL'));
echo $twig->render($template, $vars);
}

Expand Down Expand Up @@ -57,3 +58,8 @@ function collection($data)
$collection = new Collection($data);
return $collection;
}

function parseUrl($url)
{
return explode('/', filter_var(trim( $url , '/'), FILTER_SANITIZE_URL));
}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@
"require": {
"php": ">=5.6.4",
"illuminate/database": "^5.2",
"vlucas/phpdotenv": "^2.2",
"sendgrid/sendgrid": "~5.1",
"symfony/var-dumper": "^3.3",
"twig/twig": "~1.0",
"vlucas/phpdotenv": "^2.2",
"vlucas/valitron": "^1.3"
},

Expand Down
101 changes: 84 additions & 17 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3db35ca

Please sign in to comment.