Skip to content

Instantly share code, notes, and snippets.

View lucenarenato's full-sized avatar
🐘
Remoto

Renato Lucena lucenarenato

🐘
Remoto
View GitHub Profile
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\URL;
use Illuminate\Http\Client\RequestException;
use Illuminate\Support\Facades\App;
use Monicah\Cloudflare\LaravelCloudflare;
@lucenarenato
lucenarenato / Subscription.php
Created March 10, 2025 13:38
Using Laravel’s Arrayable interface to structure data
<?php
declare(strict_types=1);
namespace App\DTOs\AudienceGrid;
use Carbon\CarbonImmutable;
use Illuminate\Contracts\Support\Arrayable;
/**
@lucenarenato
lucenarenato / .unix_setup.md
Created February 13, 2025 13:57 — forked from tapyu/.unix_setup.md
Unix shell scripts for setting up GNU/Linux systems

Unix shell scripts for setting up GNU/Linux systems

General unix shell scripts for

  • autoisntall.yaml file to automatically install required packages on Ubuntu
    • The LTS version has been tested and it working
    • the nightly version hasn't been tested and it being continuously modified.
  • Additional Unix shell scripts to install other packages and extra settings.

@lucenarenato
lucenarenato / sources.list
Created November 28, 2024 18:54 — forked from hakerdefo/sources.list
Ubuntu 22.04 LTS (Jammy Jellyfish) complete sources.list
deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
@lucenarenato
lucenarenato / gitdicas.md
Created November 7, 2024 17:06
Listar commits, git discard local changes and pull

Listar commits:

git log --pretty=oneline
git log --pretty=format:"%h - %an, %ar : %s"

Ir para um commit específico:

git reset --hard 33145a2d8e2d767ec7a8e04d46e2926883c02d99

git discard local changes and pull

@lucenarenato
lucenarenato / gist:deef20cc7e4806a8f20c4287098f8c37
Last active October 14, 2024 17:37
Laravel Schedule doesn't work on my docker container

Dockerfile

FROM devilbox/php-fpm-8.1:latest

# Arguments defined in docker-compose.yml
ARG user
ARG uid

# Install system dependencies
@lucenarenato
lucenarenato / docker-compose.yml
Created September 25, 2024 16:55 — forked from LucianoCharlesdeSouza/docker-compose.yml
docker-compose usado no video sobre xdebug3 com vscode
version: "3.7"
# Networks
networks:
# Internal network
internal:
driver: bridge
services:
# api

Laravel-websockets, SSL Certificate, Let's Encrypt, Certbot, Supervisor, Digitalocean Ubuntu

I did two days work to run laravel-websockets on my server. It will be nice to share with you.

Steps

Step1 - Laravel Websockets Installation with composer

Laravel WebSockets can be installed via composer:

@lucenarenato
lucenarenato / ExampleGetImageUrl.md
Created August 5, 2024 19:51
ExampleGetImageUrl
protected $appends = ['image_url'];

    public function getImageUrlAttribute()
    {
        if (is_null($this->picture) || empty($this->picture)) {  // Check if $this->image is null
            return url('/images/sqlogo.png'); // Return default URL if null
        }
        $imageData = json_decode($this->picture, true); // Cast to array for access
        if ($imageData && isset($imageData['url']) && ! empty($imageData['url'])) {  // Check for non-empty URL

Gerar Codigo

No meu codigo legado feito em php puro, ao inserir o poduto na tabela bt_produtos, tem uma função "gerarcod" que gera um codigo aleatorio unico para coluna "pr_cod_produto"

gerarcod("bt_produtos","pr_cod_produto", 15);

function gerarcod($tabela,  $unico, $norma){
$pdo = conectar();
$grave = "sim";