The world you live in is so far from reality that I don’t even know on what basis I could talk to you. […]
Laravel 11 Form validation rules with custom logic in Request with ErrorBag
For a project we need a form for saving subscribers. You should be able to input 4 values: subscribers_f, subscribers_m, subscribers_d, and the sum of all subscribers. You can also select a category from a dropdown. For categories 2 and 3 you need to check that the actual sum (f+m+d) matches the “sum” input field. […]
Read More… from Laravel 11 Form validation rules with custom logic in Request with ErrorBag
Laravel Livewire 3: Reset Pagination after search
When you view a resultpage 2 from a paginated livewire result and change the filter or search, the generated result stays on resultpage 2. This is usually not desired. To change this behaviour and reset the Resultpage to page 1 for every new search, you can add this function to your your Livewire model: public […]
Read More… from Laravel Livewire 3: Reset Pagination after search
PDFs from spatie/laravel-pdf have no CSS when vite is not running
I create PDFs with spatie/laravel-pdf on Laravel 11, styled with TailwindCSS. My layout has I was working locally with vite running. PDfs were looking great. My deployment includes building the css with The website renders just fine with the built stylesheets from /build/assets/…. But: When I deployed my app to my forge server, the PDFs […]
Read More… from PDFs from spatie/laravel-pdf have no CSS when vite is not running
Get the sum of all rows of a multidimensional array in PHP
If you need to sum up all rows of a multidimensional array, be it an array of prices or posts or votes, in PHP you can do that like this: Result: […]
Read More… from Get the sum of all rows of a multidimensional array in PHP
Show static google map image and link to map with marker
With this snippet you can show a static google map image for a specific location, which is linked to google maps and includes showing a marker in all views.Don’t forget to change YOUR_GOOGLE_STATIC_MAPS_API_KEY to your api key, which you can get at https://console.developers.google.com by creating a server key and aactivate google maps for this account. […]
Read More… from Show static google map image and link to map with marker
Show content of folder in PHP
To show the content of a directory in PHP and make the files like images etc downloadable without changing the Webserver config, upload this snippet as index.php to the directory. <?php$pageURL = ‘https’;$pageURL .= “://”;$pageURL .= $_SERVER[“SERVER_NAME”];$httpfolder = $pageURL.$_SERVER[“REQUEST_URI”]; // The link to this folder from outside, with slash at end$dir = getcwd();$files = array_diff(scandir($dir), […]
Downgrade Ubuntu PHP Version from PHP 8 to PHP 7.4
Recently my Ubuntu server updated itself, and I suddenly had version PHP 8.0 on my terminal. I use PHP for composer installations, and some packages in my composer.json required PHP 7.4 and wouldn’t install with PHP 8. So I had to downgrade my PHP Version from PHP 8.0 to PHP 7.4 This is done like […]
Read More… from Downgrade Ubuntu PHP Version from PHP 8 to PHP 7.4
spatie/laravel-google-fonts on local environment with e.g. laragon shows “blocked: mixed content” when served over HTTPS
Problem: You use the famous https://github.com/spatie/laravel-google-fonts/, but on local development or laragon you get “blocked: mixed content”, when you call your app with HTTPS. Solution: […]
Translate Laravel system messages and errors to different languages
If you want to translate your laravel messages to different languages, you can do so in minutes with https://github.com/Laravel-Lang/lang It took me literally 1 minute to change my complete backend to german with this package. Kudos, guys, great job. […]
Read More… from Translate Laravel system messages and errors to different languages