Skip to content

Instantly share code, notes, and snippets.

View itxshakil's full-sized avatar
🏠
Working from home

Shakil Alam itxshakil

🏠
Working from home
View GitHub Profile
@itxshakil
itxshakil / post-merge
Created November 3, 2024 06:42
Automate Migration and Caching Route, Views and Config on Git Pull with Git Hooks
#!/bin/bash
echo "Running optimized post-merge hook..."
# Check for new migration files
if git diff --name-only HEAD@{1} HEAD | grep -qE '^database/migrations/.*\.php'; then
echo "New migrations found. Running database migrations..."
php artisan migrate --force
else
echo "No new migrations found. Skipping migration step."
@itxshakil
itxshakil / post-merge
Created October 11, 2024 09:02
Laravel Automatic Cache
#!/usr/bin/bash
# Check if any files in the routes folder were changed
if git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD | grep -q '^routes/'; then
echo "Changes detected in routes folder. Running php artisan route:cache..."
cd ../../
php artisan route:cache
else
echo "No changes in routes folder."
fi
@itxshakil
itxshakil / remove.php
Created December 10, 2022 21:18
Delete vendor folder from all folder in parent folder
<?php
define("START_TIME", hrtime(true));
const COLOR_GREEN = "\033[32m";
const COLOR_WHITE = "\033[97m";
const BG_BLUE = "\033[44m";
const COLOR_RESET = "\033[0m";
const BG_RESET = "\033[49m";
@itxshakil
itxshakil / .htaccess
Created September 6, 2022 06:59
Laravel HTAccess file to serve from public folder
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]