View ModelOrder.php
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 | |
public function beforeFind($queryData) | |
{ | |
parent::beforeFind($queryData); | |
// Verifica se o primeiro campo da ordenação está setado | |
if (!empty($queryData['sort']) && $queryData['sort'] == 'primeiro_campo') { | |
// Caso esteja, adiciona o segundo elemento junto à ordenação padrão |
View estrutura-categorias-e-posts.php
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 | |
function get_posts_by_category( $category_name ) | |
{ | |
$args = array( | |
'posts_per_page' => 30, | |
'offset' => 0, | |
'category' => $category_name, | |
'orderby' => 'post_date', | |
'order' => 'DESC', |
View estrutura-categorias.php
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 | |
//Código | |
$terms = get_categories(array( | |
'type' => 'represent_map', | |
'taxonomy' => 'represent_map_type') | |
); | |
$categories = array(); |
View CakeBeforeFindPaginatorWithTwoConditions.php
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 | |
//Definindo a ordenação da paginação por dois itens | |
/** | |
* | |
* @param array $queryData | |
* @return array | |
*/ | |
public function beforeFind( $queryData ) |
View exemplo de gist fica mais fácil de entender Renato Filho.php
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 | |
$this->Filter->addFilters('Filtro', array('LIKE' => __('contendo', true))); | |
$this->Filter->setPaginate('limit', 6); // opcional | |
$this->Filter->setPaginate('group', 'Qname.queue'); | |
$this->Filter->setPaginate('fields', array('COUNT(QueueStat.qname) as Total', 'Qname.queue', 'Qevent.event', 'Qevent.event_id')); | |
$this->Filter->setPaginate('conditions', $this->Filter->getConditions()); | |
$this->QueueStat->recursive = 0; | |
$this->set('queuestats', $this->paginate()); |
View ExcelExportExample.php
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 | |
header('Content-Type: text/html; charset=utf-8'); | |
header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); | |
header ('Last-Modified: ' . gmdate("D,d M YH:i:s") . ' GMT'); | |
header ('Cache-Control: no-cache, must-revalidate'); | |
header ('Pragma: no-cache'); | |
header ('Content-type: application/x-msexcel'); | |
header ('Content-Disposition: attachment; filename="' . date('Y-m-d_H-i-s') . '.xls"'); | |
header ("Content-Description: PHP Generated Data" ); |
View PagesAllowActions.php
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 | |
class PagesController extends AppController { | |
public function beforeFilter() | |
{ | |
// habilita todas as actions | |
$this->Auth->allow(); | |
// habilita actions especificas |
View gist:11320751
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 -r "readfile('https://getcomposer.org/installer');" | php |
View gist:11320697
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
curl -sS https://getcomposer.org/installer | php |
View composer.json
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
{ | |
"name": "Finanças Pessoais", | |
"description": "Uma API para gerenciamento de finanças pessoais", | |
"authors": [ | |
{ | |
"name": "Andre Cardoso", | |
"email": "andrecardosodev@gmail.com" | |
} | |
], | |
"require": { |
OlderNewer