For checking the emails going out from your local server (without actually sending them). Use papercut. https://papercut.codeplex.com/ If you’re using Laravel, then make sure to setup your app/config/mail.php correctly: ‘driver’ => ‘smtp’, ‘host’ => ‘localhost’, ‘port’ => <your papercut port>, ‘encryption’ => ”,
Different ways of getting a single model and checking if it’s there.
To protect routes, in Laravel, from unauthorized visits you can use route groups. All routes in group will be affected by the auth before filter.
Here is a simple tutorial script that uploads a file to a folder on the server. In this example it is assumed that the file is an image and it will be outputted on screen in an img-tag. But the file uploading mechanics works for any file type.
Getting OSX to install Laravel properly is a minor nightmare. Here are some good instructions on how to get it to use MAMP php instead of the broken default one that comes with OSX. https://gist.github.com/irazasyed/5987693
Here’s a simple way to paginate when getting large amounts of posts from the database.
Here’s a great tool for generating dummy data for your database etc. www.generatedata.com
Converting seconds into days, hours, minutes and seconds int days = secondsTotal / 60 / 60 / 24; int hours = (secondsTotal / 60 / 60) % 24; int minutes = (secondsTotal / 60) % 60; int seconds = secondsTotal % 60;
Sometimes you need to check if a number is even or odd. A simple way to do this is using the modulus operator (the %-sign). It will calculate and return the remainder when dividing a value with another value. So how do you use that to find out if a number is even or odd?… Read More »
A simple contact form, just for reference. Will add more info later on…