Skip to content

Instantly share code, notes, and snippets.

View elton182's full-sized avatar

Elton Nicolau elton182

View GitHub Profile
@elton182
elton182 / select.php
Created November 29, 2016 14:11
Select com laravel
<select id="subject_id" name="subject_id" placeholder="Selecione um assunto..." >
<option value="">Selecione um assunto...</option>
@foreach ($subjects as $subject)
<option value="{{$subject->id}} ">
{{$subject->description}}
</option>
@endforeach
</select>
@elton182
elton182 / phpci.yml
Created February 4, 2017 12:38 — forked from skecskes/phpci.yml
phpci.yml Laravel 5 config
build_settings:
verbose: false
prefer_symlink: false
setup:
composer:
action: "install"
prefer_dist: false
test:
@elton182
elton182 / PermissionMiddleWare
Last active April 20, 2017 21:20
Permission Middleware
<?php
namespace safed\Http\Middleware;
use Artesaos\Defender\Facades\Defender;
use Closure;
class Permission
{
/**
@elton182
elton182 / Model.php
Last active June 5, 2017 19:20
Validar Data no CakePHP
$validator
->add('occurrence_date', 'custom', [
'rule' => function ($value, $context) {
Log::write('debug',$value);
$dia = intval(substr($value, 0,2));
$mes = intval(substr($value, 3,2));
$ano = intval(substr($value, 6,4));
<?php
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use App\User;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
@extends('template')
@section('content')
<head>
<script type="text/javascript">
$(document).ready(function()
{
$("#valor").maskMoney({
prefix: "R$: ",
decimal: ",",
@elton182
elton182 / template.php
Created August 14, 2017 01:01
logica que faz o parse de valores {{name}}
<?php
function resolveTemplate($template,$data){
// search pattern
$pattern = '/{{([^}]+)}}/';
$callback = function ($match) use($data){
//var_dump($matches);
$string = trim($match[1]);
@elton182
elton182 / gulpfile.js
Created September 17, 2017 18:40
Gulp File para compilar os assets no cake
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var cssnano = require('gulp-cssnano');
var copy = require('gulp-copy');
gulp.task('minify-js', function () {
gulp.src('webroot/src/js/**/*.js')
.pipe(uglify())
.pipe(gulp.dest('webroot/js'));
@elton182
elton182 / env.php
Last active September 18, 2017 01:12
Função para usar um arquivo como arquivo de ambiente (environment)
<?php
/**
* retorna uma variavel de ambiente do arquivo .env
*
* @param [type] $var
* @return string
*/
function env($var)
{
@elton182
elton182 / datatablefilter.blade.php
Created December 8, 2017 12:41
datatable com filtros em colunas
<div class="table-responsive">
<table class="table table-bordered table-striped table-responsive" id="table" cellpadding="0" cellspacing="0" width="100%">
<thead>
<tr>
<th>Nome</th>
<th>Telefone</th>
<th>Celular</th>
<th>Data Nascimento</th>
<th>Ações</th>
</tr>