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 / UserController.php
Last active January 2, 2024 20:17
(Cakephp) Datatable Example - With custom column search and cache pagination
<?php
namespace App\Controller;
use App\Controller\AppController;
use Cake\Network\Email\Email;
/**
* Users Controller
*
* @property \App\Model\Table\UsersTable $Users
<?php
namespace safed\Traits;
Trait DataTablesTrait{
/**
* receices the model collection with records and return a json needed for the datatable
* receives de name of the Controller to generate correct URLs
* receives the customfields (for relations) that you want to return with the json
@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;
@elton182
elton182 / fluig_datepicker.html
Created July 6, 2017 13:18
fluig datepicker
<div class="form-group">
<label for="only-date">Data Emissão</label>
<div class="input-group date" id="dataEmissao">
<input type="text" class="form-control" placeholder="Informe a data de emissão" name="dataEmissao">
<span class="input-group-addon">
<span class="fluigicon fluigicon-calendar"></span>
</span>
</div>
</div>
@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]);