by Devin Yang
(This article was automatically translated.)

Published - 1 year ago ( Updated - 1 year ago )

The functions mentioned in this article can only be used for Laravel 8 and later versions
If we have some test websites outside Laravel with external IPs, but we only want to access them for ourselves.
This is how I do it for reference

First of all, I use zsh, so there is a gpw function in my ~/.zshrc, if you are using bash, it is ~/ .bashrc
So, when I need a simple random password, I can just execute gpw in the terminal and immediately spit out a random password to me.

  #generate password
  genpasswd() {
      date +%s | shasum | base64 | head -c 32 ; echo
  }
  alias gpw="genpasswd"


Then, I can build a pass.sh bash in the Laravel 8 or Laravel 9 project, the content is as follows:

#!/bin/bash
if [ $1 ];then
    php artisan up&&php artisan down --secret=$1
    PROJECT_URL=$(grep "APP_URL=" .env|cut -d= -f2)
    echo "$PROJECT_URL/$1"
else
    echo "Need new secret"
fi

Because it is a test site, I just want to see it for myself, so when I want to use it, I can set a new password for him at any time,
click the link to open it 😊


Why do you want to up and then down, because Laravel can't set new secret when it is in maintenance mode.
Of course, if you remember the password directly, you can write it down and add it to the bookmark.
 

Tags: laravel

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


laravel,letsencrypt,haproxy

PHPENV's HAProxy environment is set up with free SSL certificate application

PHPENV has added the support of haproxy.yml. If you have an external IP and domain name, it should be quite simple to get HAProxy and certificate application through deviny/phpenv. In this article, let us see how to use HAProxy in the HAProxy environment setting in PHPENV.

dlaravel

Ha, I successfully made D-Larave run in the Raspberry Pi ARM environment

I bought the Raspberry Pi this time because I thought it was very fun. In addition, the Mac environment in my home is too new to compile Line Simple Beacon normally. Through the Raspberry Pi, it is easy to use, and there will be no problems in the environment. Of course, there are more applications. But as the author of D-Laravel, of course I have to come and give it a try.....