Skip to content

Instantly share code, notes, and snippets.

View EduardoSP6's full-sized avatar

Eduardo P. Sales EduardoSP6

  • Maricá - RJ
  • 00:19 (UTC -03:00)
View GitHub Profile
@waska14
waska14 / FileHelper.php
Last active May 22, 2024 04:04
Laravel: create UploadedFile object from base64 string (autoremove temp file)
<?php
namespace App\Helpers\File;
use Illuminate\Http\File;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Arr;
class FileHelper
{
@itzikbenh
itzikbenh / TicketController.php
Last active March 9, 2022 14:43
Laravel server side processing for Datatables.
<?php
use Illuminate\Pagination\Paginator;
//This example is a bit more comlex since I have columns that are foreign keys of the Ticket table.
public function index(Request $request)
{
if($request->ajax()) {
$columns = ['tickets.id', 'client_name', 'location', 'priority_name', 'status_name', 'date'];
$draw = $request->draw;
$start = $request->start; //Start is the offset
$length = $request->length; //How many records to show
@igorcosta
igorcosta / cpf_cnpj_validator
Created June 26, 2014 19:13
Regex para validar CPF e CNPJ
Para CPF
/^\d{3}\.\d{3}\.\d{3}\-\d{2}$/
Para CNPJ
/^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/
Para ambos ao mesmo tempo