config(['app.timezone' => 'Asia/Hong_Kong']);
How to update category of all posts at once in WordPress
wp term list category
wp post update $(wp post list --post_type=post --format=ids) --post_category=NewCategoryID
How to install WordPress
wp core download --path=wordpress &&
cd wordpress &&
wp config create --dbname=wordpress --dbuser=root --dbpass=root &&
wp db create &&
wp core install --url=wordpress.test --title=WordPress --admin_user=admin --admin_password=password --admin_email=admin@example.com --skip-email
How to generate WordPress child theme
wp scaffold child-theme twentytwentyfour-child --parent_theme=twentytwentyfour --theme_name="Twenty Twenty-Four Child" --activate &&
cp wp-content/themes/twentytwentyfour/screenshot.png wp-content/themes/twentytwentyfour-child
How to encrypt and decrypt environment file in Laravel
php artisan env:encrypt
php artisan env:decrypt --key=KEY
How to check blank page issue in Laravel
php artisan
How to display basic information about your Laravel application
php artisan about
How to set Mailpit with Laravel on Mac
brew install mailpit && brew services start mailpit
sed -i.bak -e 's/MAIL_MAILER=log/MAIL_MAILER=smtp/g' -e 's/MAIL_PORT=2525/MAIL_PORT=1025/g' .env
php artisan tinker
Mail::raw('Message', fn ($msg) => $msg->to('admin@example.com')->subject('Subject'));
How to replace the default database SQLite with MySQL in Laravel
sed -i.bak -e 's/^DB_CONNECTION=sqlite/DB_CONNECTION=mysql/g' -e 's/^# DB/DB/g' .env &&
rm -rf database/database.sqlite
How to change locale in Laravel
sed -i.bak 's/^APP_LOCALE=.*/APP_LOCALE=en_HK/g' .env