Laravel - Send Email Example

In order to send an email message from laravel, there are numerous ways to do so. Here is the least complicated one.

mirror/flip in css

how to mirror or flip text or image with css

json_encode & JSON.parse

Sometimes, you will need to transform a php array into a json string in order to send it to a javascript code to work on it. In this case you will have to use the php built in function json_encode($phpArray) and then in javascript code, you have to transform this json string into an object so that you can iterate over it or do whatever you want with it, Now on javascript you can do this by using JSON.parse(allSearchableTags)

show right modal based on right error type

how to show right modal based on right error type specially in case that there are 2 modals on the same page

Custom validation error messages

In case you wanetd to change the error message of a validation rule in Laravel you can make use of the following snippet.

Keeping modal dialog open after validation error laravel

Laravel automatically checks for errors in the session data and so, an $errors variable is actually always available on all your views. If you want to display a modal when there are any errors present, you can try something like this:

Setting value of input type=datetime-local on laravel

how to Set value of input type=datetime-local on laravel

Highlight elements inside a list once clicked

If you have let's say an unordered list and it is populated with multiple items and you need to highligh the clicked item and if clicked again remove the highlight. A very good and interresting way to do this is to make use of the buble behavoir for events and add event listener only for the parent container element, and then use the event.target to get to the clicked element itself, which is the list item in our example.

show old input value when editing a form in Laravel

show old input value when editing a form in Laravel specially on validation error