Working With Scopes In Laravel

Sometimes you run into a situation when you have to reuse some of the conditions more, with the help of scopes we can easily reuse or create common functionality for particular queries. Laravel scopes provide a way to define model functions that especially run on query methods. In this tutorial, we will show you how

Learn More

How to Check Table Or Column Exists In Laravel

While working on an enterprise-level project, it commonly occurs that we want to create a particular table or column into a table that already exists and that shows an error. In this tutorial, we will see how to check particular table or column exists or not. Typical migration looks like below code: When we run

Learn More

Order Data By Mutator Attribute In Laravel

Accessor and mutator help us to change data by custom functionally automatically. While working with a mutator sometimes we need to order or sort data by mutator column. But the Eloquent model’s orderBy() method doesn’t work with mutator value. So how to order data by mutator column value? In this article, we will create a

Learn More

API Versioning in Laravel

While upgrading the functionality of the application sometimes we need to change the majority portion of logic. In common cases doesn’t affect web applications but for APIs, it can be tricky. Some users don’t choose to upgrade the application and they can face errors in using the same APIs. API versioning provides a way to

Learn More

Generate String Acronyms with Laravel Macro

While creating social media applications or blog platforms sometimes requirements arise for showing Acronyms of user names or some titles. In this post, we will generate string Acronyms using koenhendriks/laravel-str-acronym. The Laravel Str Acronym provides a macro for generating acronyms from strings in Laravel projects using the Str helper and also supports the Stringable class.

Learn More

How to enable CORS in Laravel

In this post, we will explain what cross-origin resource sharing (CORS) is and how to enable CORS for Laravel applications. What is CORS? CORS stands for Cross-Origin Resource Sharing. Generally, assets like images, stylesheets, and scripts can be easily embedded into web pages. CORS is a browser mechanism that enables controlled access to resources outside

Learn More

How to get the current URL in Laravel

One common task that developers encounter while working with Laravel is getting the current URL of the page. The reason can be anything like checking which menu should be active or the user has the right to access specific URLs. In this article, we will explore different ways of getting the current URL in Laravel.

Learn More