laravel 函数到全局
laravel function to global
我想始终在 laravel/homestead 的全局范围内使用此函数作为描述 Here
用这个函数:
function homestead() {
( cd ~/Homestead && vagrant $* )}
我用Ubuntu
它将代替 vagrant
此致
只需将此函数粘贴到您的 .bashrc 文件中
function hs() {
cd ~/.composer/vendor/laravel/homestead
command=""
if [ "$command" = "edit" ]; then
open ~/.homestead/Homestead.yaml
else
if [ -z "$command" ]; then
command="ssh"
fi
vagrant "$command"
fi
cd -
}
然后您可以从系统中的任何位置调用 hs edit
、hs up
hs ssh
等。
别忘了source ~/.bashrc
我想始终在 laravel/homestead 的全局范围内使用此函数作为描述 Here
用这个函数:
function homestead() {
( cd ~/Homestead && vagrant $* )}
我用Ubuntu
它将代替 vagrant
此致
只需将此函数粘贴到您的 .bashrc 文件中
function hs() {
cd ~/.composer/vendor/laravel/homestead
command=""
if [ "$command" = "edit" ]; then
open ~/.homestead/Homestead.yaml
else
if [ -z "$command" ]; then
command="ssh"
fi
vagrant "$command"
fi
cd -
}
然后您可以从系统中的任何位置调用 hs edit
、hs up
hs ssh
等。
别忘了source ~/.bashrc