Laravel Forge, where are the rewrite rules?

If you are using Laravel Forge and want to have a debug at a site’s rewrite rules, this is their location: /etc/nginx/forge-conf/mysite.com/server/redirect_rules.conf Notes Don’t change them manually;...

Nginx rewrite rules and match only beginning of string

A nice little gotcha. Often when you write Nginx rules, you forget that it matches everything in the string. Imagine if you want this redirect /product-a -> /category-1/product-a

Test event inside an Eloquent observer

Most times you test that events are fired by adding Event::fake() to your tests. This will make Event::assertDispatched(SomeEvent::class) to return true. However, no events will trigger as soon...

Mock Laravel Cache remember for ever

Sometimes you want to make sure certain things are cached properly. With mocking this is possible. In this example I will show how to test Cache::rememberForever and see the...

Cannot add foreign key constraint

The most common error I see when trying to create foreign key constraints is you forget that the colmuns must have the same type, including unsigned() if unsigned. In...