Recent Posts

How to use Repository Pattern in Laravel
When tackling the separation of concerns, this is very important. Another benefit is how easy it makes it swap out your backend technology. For instance, let’s say you are using MySQL and want to change to MongoDB. Since the...
13 Comments
Creating Custom Facades in Laravel
Facades provide a static interface to a class that gives access to an object from the service container. You can define a facade simply by using getFacadeAccessor method for a facade class. In this post will create a custom facade in...
0 Comments
Eloquent Touch for Models in Laravel
Today I want to show you two tricks while working with Laravel. Probably you will know one of them but might not know the other one. So, you know there are fields created_at and updated_at in Eloquent tables, right? The first trick is we...
0 Comments
Service Providers in Laravel
Service providers are the central element of the initialization process where all the relevant and required code is loaded by PHP. This includes all the essentials from the framework itself, but also any own and custom code you need to...
0 Comments
Service Containers in Laravel
The service containers concept in Laravel is one of the most misunderstood parts of the framework. It is rather complex and abstract but for the enlightened, it provides great extensibility to your code and a useful way of managing class...
0 Comments
Getting Random Rows in Laravel
Laravel’s Query Builder has a method get() to actually get the rows, but what if we want to get random rows? Like, for example, we have 100 products in the database, and want to show 10 random ones? The bad news is there is no method...
1 Comments
Share Data in Partial Views using Laravel View Composer
Have you ever been in a situation, where you have to share the same data with multiple views in Laravel application? Surely, you can pass the data using controllers to views, but duplicating the same thing in multiple controllers make...
0 Comments
Filtering Eloquent Models in Laravel
When you are trying to filter some data or making a search query, you have to decide how you want to implement the filtering on eloquent models. I usually ask myself, should I include filtering logic in Controllers?...
2 Comments
8 Laravel Helpers I Use Everyday
Laravel provides a ton of helper functions which can be very useful to accomplish basic tasks. You can check out all helper functions on Laravel Official Documentation webpage. In this post, I will be listing some of the best helpers...
0 Comments
Page 2 of 3