Skip to content

Instantly share code, notes, and snippets.

@tabacitu tabacitu/.zshrc
Last active Jul 25, 2019

What would you like to do?
Quickly create a Backpack Demo, serve it with Laravel Valet, open it with Sublime Text and Brave Browser on Mac OS X
# alias to the subl command
# for it to work, you need to create a symlink to the subl command somewhere in the PATH
# ln -s "/Applications/Sublime" /usr/local/bin/subl
alias sublime='subl'
# function to open the current directory in the browser, served by Laravel Valet
safari() {
open 'http://'$(basename $(pwd))'.test/';
# function to open the current directory in the Brave Browser, served by Laravel Valet
brave() {
open -a /Applications/Brave\ 'http://'$(basename $(pwd))'.test/';
# function to start working on a Laravel Valet project; opens it in Brave, in Sublime and runs a git status
work() {
subl .
git status
# function to install a new backpack demo, with a give name
newdemo() {
mysql -u root -e "CREATE DATABASE IF NOT EXISTS \`$*\` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
git clone ~/Sites/$*
cd ~/Sites/$*
composer install
cp ~/backpack-demo.example.env ~/Sites/$* #copy .env example file to current directory
mv ~/Sites/$*/backpack-demo.example.env ~/Sites/$*/.env #correct name for .env file
sed -i '' 's/backpack-demo/'$*'/g' ~/Sites/$*/.env #change DB_DATABASE and APP_URL in .env file
php artisan key:generate
php artisan migrate
php artisan db:seed --class="Backpack\Settings\database\seeds\SettingsTableSeeder"
php artisan db:seed
php artisan backpack:base:user --name='Cristian Tabacitu' --email="" --password="mydefaultpassword"
#get all backpack packages again, with version control
rm -rf vendor/backpack
composer install --prefer-source
#open text editor and see status
# function to delete a laravel project, with a given folder name
# assumes folder name and database name are the same
dump() {
rm -rf ~/Sites/$*
mysql -u root -e "DROP DATABASE \`$*\`;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.