The Problem Do you see a json ajax response instead of the page you were expecting when hitting the back button? This can happen if you use the the same routes for your html and ajax like so. The problem is that the browser (depending on the browser) decides to cache data that is passed … Read more
I’m experiencing Heroku’s H18 errors uploading large files and passing it to an S3 instance. It happens itermittently. The Heroku docs say the following. Usually, an H18 indicates that a response has multiple stages – forinstance, streaming chunks of a large response – and that one of thosestages has thrown an error.https://devcenter.heroku.com/articles/error-codes#h18-server-request-interrupted The docs further … Read more
Detect mobile usage in Vue with screen width: With browser useragent: With npm package (https://www.npmjs.com/package/vue-mobile-detection):
When adding a column in a Laravel migration, you can add the column in a specific order by using the following format in your schema builder. Note that this only works with MySQL 🙁
This is a shoutout to Laravel’s Query Builder method distinct(). I feel sad and embarrassed that I didn’t know about it sooner. There are a lot of instances where I need to get a column’s unique values. And instead of using groupBy() and wasting a lot of resources. You can use distinct(), which will search … Read more
To validate an array of objects in Laravel, you can use the * identifier for each item in an array, and use the “.” syntax to point to the property. So the above would read, “Each item in the row array’s title is required,” etc.
To install PECL on your mac, use curl as shown below to download the go-pear.phar file or just download the go-pear.phar file via your browser. You’re now ready to configure PEAR for installation. First you need to change the Installation Base. So type 1, and then press Enter. Enter /usr/local/pear Press Enter. Then, you will … Read more
Didn’t know Carbon parse has a ‘W‘ format week! Also, if the column is a date or datetime field you can skip Carbon::parse().
Need to convert a float or string into a currency format in Laravel? Here are two quick methods. Use PHP’s number_format() in your blade template. You can also add the following to your AppServiceProvider’s boot method. Good luck!
How do you cache efficiently in Laravel? Trying to figure out an efficient way to serve data using the least amount of resources is always a challenge to face when scaling. How much of the data to process in the front vs back end. When to cache and how to handle the scope of what … Read more