Skip to content

Instantly share code, notes, and snippets.

View allanfreitas's full-sized avatar
🏠
Working from home

Allan Freitas allanfreitas

🏠
Working from home
View GitHub Profile
<?php
class Arrays{
/**
* Sample $obj = Users::all();
* @param Object(Eloquent) $obj
* Key usage for assoc with value in the array $data
* @param string $key
* Value usage for fill array $data
* @param string $value
* Enable first element
<?php
class MysqliConn{
/**
* @return Instance of Mysqli $mysqli
* @author Flávio Henrique Ferreira <[email protected]>
**/
public static function conecta(){
/*
sudo su -
# stuff we need to build from source
apt-get install libpcre3-dev build-essential libssl-dev
# get the nginx source
cd /opt/
wget http://nginx.org/download/nginx-0.8.54.tar.gz
tar -zxvf nginx*
# we'll put the source for nginx modules in here
<?php
/**
* Controller is the customized base controller class.
* All controller classes for this application should extend from this base class.
*/
class RestController extends CController
{
/**
* @var string the default layout for the controller view. Defaults to '//layouts/column1',
* meaning using a single column layout. See 'protected/views/layouts/column1.php'.
jQuery.validator.addMethod("cnpj", function (cnpj, element) {
cnpj = jQuery.trim(cnpj);
// DEIXA APENAS OS NÚMEROS
cnpj = cnpj.replace('/', '');
cnpj = cnpj.replace('.', '');
cnpj = cnpj.replace('.', '');
cnpj = cnpj.replace('-', '');
var numeros, digitos, soma, i, resultado, pos, tamanho, digitos_iguais;
<!doctype html>
<html ng-app="project">
<head>
<title>Angular: Service example</title>
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<script>
var projectModule = angular.module('project',[]);
projectModule.factory('theService', function() {
return {
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ /public/$1 [L]
var Ctrl = angular.module('Controller',['ngRoute','Service']);
Ctrl.controller('Home',function($scope, TextoService,$rootScope){
$scope.title = "Administração - Home";
$scope.textos = [];
TextoService.get(1).then(function(d) {
$scope.textos = d;
$rootScope.textos = d;
});

Did I hear you wanted AJAX charts instead of hard coded? You got it.

Follow this guide to integrate bar chart reports into your Laravel application with AJAX. Reports like the following come with this guide:

  • Total number of Orders by day
  • Total number of Users subscribed by day
  • etc

The library used for the charts is: http://www.oesmith.co.uk/morris.js/

Follow this guide to integrate bar chart reports into your Laravel application. Reports like the following come with this guide:

  • Total number of Orders by day
  • Total number of Users subscribed by day
  • etc

The library used for the charts is: http://www.oesmith.co.uk/morris.js/

First put this into your page that will have the reports (in the Blade view) to include Morris library: