Skip to content

Instantly share code, notes, and snippets.

View webong's full-sized avatar
:octocat:
Working from home

Wisdom Ebong webong

:octocat:
Working from home
View GitHub Profile
@nathandaly
nathandaly / BaseResource.php
Last active August 12, 2025 21:28
Tenancy for Laravel & Filament V3 (Tenant per database)
<?php
/**
* Below is an the extended Filament resource your tenant panel resources
* will have to extend so that the queries are scoped properly.
*/
namespace App\Filament;
use Filament\Resources\Resource;
update contacts set contact=CONCAT("+99", floor(rand(current_timestamp())*999999999)) where type='phone';
update users set realname=CONCAT('Random ', floor(rand(current_timestamp())*9999999)), email=CONCAT(CONCAT('random', floor(rand(current_timestamp())*9999999)), '@example.com') where role <> 'admin';
update users set password='$2y$15$Ha7nHVZApHXfzhrD2HCukuUjjQhIUzPJ0JNWk7KooT6edQFTbeWr6'; /* "admin" .. DON'T RUN FOR STAGING */
update users set email='admin@example.com' where id=1;
delete from config where group_name='data-provider' and config_key in ('email', 'twitter');
delete from config where group_name='twitter';
truncate oauth_refresh_tokens;
truncate oauth_access_tokens;
truncate webhooks;
@JosephmBassey
JosephmBassey / nginx.conf
Last active March 1, 2020 17:29
An nginx conf for routing sub domain request to different port with ssl support. You can repeat this for as many sites as required, you just defines an additional server block(s) for each site(sub domain). Note that this strategy requires TLS SNI support on both server and client
server {
listen 80;
server_name admin.mysite.com www.admin.mysite.com;
}
server{
location / {
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:3000;
proxy_redirect off;
@arthursalvtr
arthursalvtr / add-custom-mail-driver-to-laravel.md
Last active July 11, 2025 08:01
Add Custom Mail Driver to Laravel

How to add custom Mail Driver to Laravel

Tested on Laravel 5.8

Within the source code of laravel 5.8 at this time of writing, we have this following

<?php

namespace Illuminate\Support;
const pool = require('../database/database');
const { generateId } = require('../functions/id');
//Import Company Crud Operations
module.exports.addImportCompany = async (req, res) => {
const { name, address, email, phone, total_transactions, remain_transactions, purchase_type } = req.body;
const contact_info_id = generateId("COMP");
if (!purchase_type || purchase_type.length == 0) {
@vicgonvt
vicgonvt / deployment_guide.md
Last active July 17, 2025 01:37
Deployment Guide for Ubuntu Server from Scratch with Laravel
@ivanvermeyen
ivanvermeyen / HOWTO.md
Last active June 8, 2025 14:55
Multiple MySQL versions on MacOS with Homebrew

Update - 4 september 2020

Making multiple MySQL versions work with Homebrew was tricky to say the least. Fortunately there are 2 new easy ways that I learned of to achieve this.

DBngin app

As @4unkur and @henrytirla commented below, there is this extremely easy to use app called DBngin, which lets you setup multiple databases (not only MySQL) simultaneously using different ports:

https://dbngin.com/

@kyleparisi
kyleparisi / .env.testing
Last active January 28, 2020 19:35
Laravel + Docker testrig (alternative to homestead/valet?). Requires only docker as local dependency.
APP_ENV=testing
APP_KEY=base64:blahblah
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=homestead
@rhukster
rhukster / sphp.sh
Last active March 30, 2024 10:41
Easy Brew PHP version switching (Now moved to https://github.com/rhukster/sphp.sh)
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
#
# >>> IMPORTANT: Moved to: https://github.com/rhukster/sphp.sh
# >>> Kept here for legacy purposes
#
osx_major_version=$(sw_vers -productVersion | cut -d. -f1)
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2)
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3)