Skip to content

Instantly share code, notes, and snippets.

View diegoglz-dev's full-sized avatar
🤙
Sin Juniors curiosos, no hay Seniors experimentados.

Diego Gonzalez diegoglz-dev

🤙
Sin Juniors curiosos, no hay Seniors experimentados.
  • La Plata, Argentina
View GitHub Profile

Laravel 11 - Authentication for role

1º step: Create middleware

php artisan make:middleware RedirectIfNotAdmin
// in RedirectIfNotAdmin.php
@diegoglz-dev
diegoglz-dev / change_product_id_to_items_table.php
Created July 31, 2023 23:42
Change nullable foreign key on production.
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
@diegoglz-dev
diegoglz-dev / add_price_to_customer_orders_table.php
Created July 31, 2023 23:40
Add and drop foreign key in migration on production.
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
@diegoglz-dev
diegoglz-dev / Livewire Intervention Image File Upload
Created July 5, 2023 02:52 — forked from daugaard47/Livewire Intervention Image File Upload
Upload images with Livewire and compress with Intervention Image.
//HTML
<div class="avatar-file">
<label class = "text-bh-navy-500">Choose Image</label>
<input type = "file" wire:model = "avatar">
</div>
//LW Component
use WithFileUploads;
public $avatar;
@diegoglz-dev
diegoglz-dev / sorteoEquipos.js
Created February 25, 2023 00:29
Sorteo de equipos para fútbol 5
function shuffleArray(arregloJugadores){
arregloJugadores.sort(()=> Math.random() - 0.5);
}
var jugadores = [
"Nani",
"Diego",
"Braian",
"Fede",
"Manu",
@diegoglz-dev
diegoglz-dev / BuscadorCamino.java
Last active November 25, 2022 18:28
Grafos Buscador de Camino con Presupuesto Minimo
public class BuscadorCamino {
ListaGenerica<String> caminoConPresupuesto(Grafo<String> ciudades, String origen, String destino, int montoMaximo) {
ListaGenerica<String> camino = new ListaEnlazadaGenerica<String>();
ListaGenerica<String> temporal = new ListaEnlazadaGenerica<String>();
boolean[] marca = new boolean[ciudades.listaDeVertices().tamanio() + 1];
Vertice<String> vOrigen = buscar(ciudades, origen);
if (vOrigen != null)
caminoConPresupuesto(ciudades, destino, montoMaximo, camino, temporal, marca, vOrigen.getPosicion(), 0);