Skip to content

Instantly share code, notes, and snippets.

@luukverhoeven
Created April 22, 2018 08:31
Show Gist options
  • Save luukverhoeven/ee07a39f3f934b366e4c526c53570b91 to your computer and use it in GitHub Desktop.
Save luukverhoeven/ee07a39f3f934b366e4c526c53570b91 to your computer and use it in GitHub Desktop.
Laravel bash tool for your local machine
#!/bin/bash
# Author: Luuk Verhoeven - MoodleFreak
# Version: 1.0
# Should be linked as a alias in your bashrc or zshrc
red=`tput setaf 1`
green=`tput setaf 2`
yellow=`tput setaf 3`
magenta=`tput setaf 5`
reset=`tput sgr0`
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "${red}Laravel Tools by Ldesign Media${reset}"
# Clear all cache classes and views
clear(){
php artisan cache:clear
php artisan clear-compiled
rm -f bootstrap/cache/config.php
composer dumpautoload
composer update
}
# Install a new laravel project
new (){
laravel new $1
cd $1
composer install
yarn install
touch README.md
cp .env.example .env
git init
git add -A
git commit -m 'Initial commit'
php artisan key:generate
php artisan config:clear
php artisan config:cache
}
search(){
here=$(pwd);
echo "${green}search($here)${reset}"
grep --include=\*.{css,php,js} -rnw $(pwd) -e "$1"
}
help () {
echo "functions available:"
typeset -f | awk '/ \(\) $/ && !/^main / {print $1}'
}
# Mapping to functions above.
if [ "_$1" = "_" ]; then
help
else
"$@"
tput sgr0 # Reset colors to "normal."
echo
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment