How to add custom cast type in Laravel?

How to add custom cast type in Laravel

What is casting in Laravel? With casting we can transform Eloquent attribute values when retrieving or set them on model instances. Casting does not require to define any additional methods on model. The $casts property is an array. The key of the array is the name of the attribute being cast and the value of … Read more

How to force HTTPS scheme in Laravel?

How to force HTTPS scheme in Laravel

Overview Hypertext Transfer Protocol Secure (HTTPS) is the secure version of HTTP. This is important when users are transmitting sensitive data. The browsers we use to access a website these days flag the website as insecure if it has an insecure URL like http://example.com/home. To have HTTPS in our website we need to purchase and … Read more

How to create custom facades in Laravel?

create custom facades in Laravel

In this article we will learn how to create custom facades in Laravel. But first we will know what facade is in Laravel. What is facade in Laravel? Facades provide a static interface to underlying classes in the service container. Facades also provide a memorable syntax to use Laravel’s features without remembering long class names … Read more

What is method spoofing in Laravel?

method spoofing in Laravel

In this article we will discuss about method spoofing in Laravel. But first of all we will know about HTTP method. HTTP Methods HTTP defines a set of request methods. Through the HTTP request method we can take action on any resource of the server. In other words, the purpose of the HTTP request is … Read more

How to create custom helper function in Laravel?

create custom helper function in Laravel

In this post we will first learn what is helper function in Laravel and then we will learn how to create custom helper function in Laravel. Helper function in Laravel Overview Helper functions in Laravel are PHP functions which are pieces of code that are used in many files of the application. Various helper functions … Read more

How to build layouts using template inheritance in Laravel?

Build layouts using template inheritance in Laravel

What is layout? Generally in web application the same layout is used in different pages. By defining the layout in a single blade template we can use it in the entire application. We will create the layout using “template inheritance”. For that we will follow the following steps. Steps to build layouts using template inheritance … Read more

How to share data with all views in Laravel?

share data with all views in Laravel

Before knowing how to share data to all views in Laravel, let’s know how to share data to a specific view file in Laravel. Share data to a specific view file in Laravel To share data in views we usually pass an array of data from the controller or routes to views in a key-value … Read more