Categories
Laravel

Laravel Validation – All Errors for One Field

Laravel’s message bag as the $errors->all() method to get all errors, across all fields.

Single error for a field in Blade helper:

@error('the_field') {{ $message }} @enderror

All errors for one field

$errors->get('the_field');
Categories
Uncategorized

Remove SSL from certbot

When you point a domain away from a server with Let’s Encrypt and Nginx tries to restart after SSL renewal it will fail. The domain IP link is broken, so you’ll get expired certs on unrelated sites.

To remove the SSL with certbot:

cd /opt/certbot
./certbot-auto certificates   //list existing certs
./certbot-auto delete --cert-name example.com

Categories
Uncategorized

Vue Testing Library didn’t work with Laravel

Broken code inside one of the dependencies of VTL, which I suspect is a conflict with the my versions of something else.

If I revisit it will try the Laracasts guide which uses the lower level library + manually pairing it with a test runner such as Jest.

Categories
WordPress

Updating SVN Repo

You may update without changing the code. This happens when I test a plugin with a new version of WordPress and don’t need to make any code changes.

Update the readme.txt with new info, then:

svn ci -m "My cool message"

This is the same command to push new changes that do involve updated code.

If SVN is unauthenticated use your wordpress.org account username (which is not the email address) and password. For me that is mikehealy.

Categories
Workflow

Remove Files from Git Repo

From: https://medium.com/better-programming/how-to-remove-committed-files-from-git-version-control-b6533b8f9044


  1. Create a .gitignore file, if you haven’t already
  2. Edit .gitignore to match the file/folder you want to ignore
  3. Execute the following command: 
    git rm --cached path/to/file
  4. Git will list the files it has deleted. The --cached flag should be used if you want to keep the local copy but remove it from the repository.
  5. Verify that these files are being deleted from version control using git status
  6. Push the changes to the repository

After completing these steps, those files should be removed from version control but not removed from any local machine. Any other developer which pulls again after you pushed your changes should have no issues.

How To Remove Committed Files From Git Version Control

Categories
Workflow

Rename Default Git Branch

Rename on Github first.

Then:

git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
Categories
PHP Workflow

Upgrading Local PHP with PHP-FPM

Updated and linked new version with Homebrew. Update path in terminal manager may help third party programs too.

PHP comes with its own PHP-FPM. For the new version I modified its config to run on a new port.

/usr/local/etc/php/8.0/php-fpm.d

e.g. ran this version at 127.0.0.1:9080

brew services restart php

Then in nginxcfg for a virtual host I updated its config to call php-fpm at that port. That site runs PHP 8.0. Others using old port seem to still be working with PHP 7.4.6. Unsure if that will survive a restart, or if only one version of php-fpm will be running (?)

Categories
WordPress

WooCommerce PayPal Checkout is slow

When active it sends an HTTP API request on every page load to PayPal. Adds >1 second to every frontend page render.

How does this shit pass QA?

Categories
Uncategorized

Don’t Write Your Own Tailwind

Creating some, but not enough, utility classes was a mistake. Should just use Tailwind, or not, but not half and half.

Categories
Workflow

Restart Nginx Locally Mac

sudo brew services stop nginx
sudo brew services start nginx


Sudo because I have it bound to :80, which is otherwise not allowed.

Seems to work better than singular restart command (I think)