Codeware 

Catch TokenMismatchException thrown by VerifyCsrfToken in Laravel

If you are using Laravel 5, you must have come across something like this when a form wasn’t after a long period of time of opening the page.   This was meant to help with checking against CSRF but it can be really annoying seeing this. Most of your user/visitors don’t understand the gibberish written, and you can’t possibly tell them to always submit the forms on time. No, you just can’t. Neither should you assume that they will only be visiting your website/app at the time they are on the…

Read More
Codeware 

Bind multiple models to a form in Laravel 5 and validate it

Form model binding in Laravel 5 makes the programmers’ live easier, no doubt. But what if you want to bind multiple models to a form? This is not straight forward but it’s not so complex either. (May be it was till I cracked it) Follow the steps below and you should be okay. Note: I am assuming that there is a one on one relationship between the models you are binding. Form model binding works if you have Laravel Collective’s Form & HTML package installed in your project.   Creating the…

Read More
RecyclerView was introduced with Android Lollipop Codeware 

How to prevent Android’s RecyclerView from recycling views

The RecyclerView widget, alongside the CardView widget, was introduced in Android API 21 (Lollipop). RecyclerView is a more flexible and more advanced version of ListView, according to Android developers’ website. But don’t read flexible as easier to implement. It’s cool though. yeah, it’s ListView on steroids. One of its key feature is that it recycles views that are out of device screen. It is a cool feature but it’s not always a good thing. There are times you don’t really want to recycle views. Or when recycling messes up your display.…

Read More
Codeware 

How to create custom helper functions in Laravel 5

Creating simple PHP helper functions in Laravel 5 is not really something that comes out of the box, unlike what is obtained in CodeIgniter. This is one of the very few things I initially missed when I switched from CodeIgniter to Laravel. However, there is a short solution. This might not necessarily be in compliance with Laravel’s best practices, but I kinda like it. Besides, it’s pretty straight forward. Follow these three steps and you are good to go. 1. Create a Helper’s folder Go to your app folder, create…

Read More
%d bloggers like this: