First you need to install illuminate/validation
by typing this composer require illuminate/validation:5.1.*
.
Then, you can use laravel validation like this:
$validatorFactory = new ValidatorFactory;
<?php | |
use SimpleXMLElement; | |
/** | |
* CaixaResponseReader | |
* | |
* Realiza o parsing do xml retornado pelo webservice da caixa | |
* | |
* @author Matheus Lopes Santos <[email protected]> |
# Adicionar essa linha no arquivo phpstorm.sh da pasta do seu editor | |
export XMODIFIERS="" |
<?php | |
return [ | |
// Configuração da conexão padrão | |
'default' => env('DB_CONNECTION', 'firebird'), | |
// Configurações dos outros bancos de dados | |
// COnfiguração do firebird | |
'firebird' => [ |
<?php | |
namespace App\Events; | |
use Illuminate\Contracts\Broadcasting\ShouldBroadcast; | |
use Illuminate\Queue\SerializesModels; | |
class NewMessage extends Event implements ShouldBroadcast | |
{ | |
#Configurações para retirar o index.php das urls, deixando-as mais amigáveis | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
# Directs all EE web requests through the site index file | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ /index.php/$1 [L] |
Recently I was asked to generate PDF invoices for an online shop. I looked at various PHP PDF generators, but wasn't particularly impressed with any of them.
Then I found (via Stack Overflow) a command-line HTML-to-PDF convertor called wkhtmltopdf, which uses WebKit (the same layout engine as Safari and Google Chrome) and therefore is very accurate.
There is a class for PHP integration on the Wiki, but I found it overly complicated and it uses temp files which aren't necessary. This is the code I wrote instead.
I used Smarty for generating the HTML for the PDF, but you can use any template engine, or pure PHP if you prefer.
Note: I originally tried to install wkhtmltopdf from source, but it's much easier to use the static binary instead.
<?php namespace App\Traits\Db; | |
use Config; | |
/** | |
* DatabaseConnectionTrait | |
* | |
* Realiza a reconfiguração do banco de dados baseado no nome da conexão | |
* definido no model | |
* |
/* | |
<a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request | |
- Or, request confirmation in the process - | |
<a href="posts/2" data-method="delete" data-confirm="Are you sure?"> | |
*/ | |
(function() { |