Laravel 5 Pagination with array

Laravel provides pagination for Eloquent results out of the box, but for custom data we need to do the pagination manually. In this tutorial, I’ll use Laravel5 LengthAwarePaginator class to show you how you can create […]

Multiple Route files in Laravel 5

For small scale applications single route file is sufficient but large scale applications its cumbersome to maintain and organize the routes. The solution for this was creating multiple route files. For example if you […]

Laravel 5 – SHA1 encryption instead of BCrypt

Recently I have migrated core PHP application to Laravel5 framework. Old application used SHA1 encryption so I have implemented Hashing contracts of laravel5 to use SHA1 instead of BCrypt. Create Directories in “app” […]

Laravel 5 – Prevent Browser back button after Logout

In this post I would like to share a simple Laravel5 Middleware which prevent going back to previous protected page after Logout by hitting the back button on your Browser. When you hit the browser back button after logout, […]

How to add custom class in Laravel 5

In this tutorial I will show you how to add custom class in Laravel 5. For example my class name is Common.php. Now create a directory called Mylibs in app directory(app/Mylibs). Place your custom class in created directory […]

Laravel 5 get current authenticated user?

Upon successful login you can get current user details by called Auth::user() method. It will return null if no user logged in or there is no current user. On successful login Auth::user() return value is based on your […]

Laravel 5 redirect (some) requests to HTTPS

I know we can achieve same with other methods but I am going with Laravel Middleware. So let’s create Middleware called “ForceHttpProtocol”. Our ForceHttpProtocol middleware will redirect every request […]

How to install Laravel 5

In this post I am going to share laravel installation steps. We Can install laravel by using composer and laravel installer. Laravel Installer is a new features which is introduced in Laravel 4.1, which can create a project […]

Laravel 5 Eloquent – Attribute casting

One of the Laravel 5 awesome feature is Attribute casting. Casting attribute means changing the attribute values to a particular type. for example Boolean, integer, strings. Eloquent models allows you to change datatype […]

Where NOT in Eloquent join Relation

Here is the simple laravel’s eloquent code snippet to get results in a table when there are no results for the relationship. I have two tables called users and accounts. each account belong to one user ,some users […]