How to block IP addresses from accessing the application

How to block IP addresses from accessing the application

Middleware is a kind of rule which we enforce as per our requirement. Laravel has built-in middleware like Auth. We can create our own middleware as per the requirements and rules and block IP addresses from accessing the application. Sometimes we need to validate the IP address in the application. We know that these days DDoS attacks are common on servers. Though most of the hosting provider provides the DDoS...
How to use Session in Laravel

How to use Session in Laravel

In a login and registration process, we have to identify the user in the whole project once the user gets authenticated. We all know that we use sessions to store information about the user across the request. So in this post, we will learn about the Laravel session and its use. Laravel has various drivers like file, cookie, Memcached, array, apc, Redis, and database to handle session data. By default,...
How to Load different CSS and JS for different views in Laravel

How to Load different CSS and JS for different views in Laravel

In many applications when we start the project we tried to keep the common things separate, for example in PHP when we developed the website we keep the header, sidebar, footer separate, and JS and CSS we also make separate files. This approach helps us to manage the changes easily in the project. The same way we separate the parts in Laravel blade templates. We keep the master layout and...
A possible solution for Laravel Undefined offset: 0 error

A possible solution for Laravel Undefined offset: 0 error

If we access an index that does not exist or an empty offset, it will lead to an undefined offset error. Sometime during the route call in Laravel, we get Undefined offset errors. This may lead to confusion if we do not know what is the cause of the error. In this article, we have tried to explain possible solutions for Laravel Undefined offset 0 errors. Undefined offset: 0 It...
How To Delete All Records From Table In Laravel

How To Delete All Records From Table In Laravel

In this tutorial, we will explain to you different methods to delete all records from the table in Laravel. You can easily remove the record with the following examples. Sometimes we need to delete all the records from the table at once. Let's see a scenario where we need data on a daily basis of users in that we need users all activity. And at the end of the day,...
How to pass data to view in Laravel

How to pass data to view in Laravel

Laravel provides many methods to pass the data to a view. We have different methods to pass the data in Laravel. We can pass the data directly from the controller or through routes. Laravel provides many methods to do the same task, whichever method you feel you are comfortable with, you can use that method to do some particular task in the framework. In this post, we will learn that...
What are the Route Groups and its use in Laravel

What are the Route Groups and its use in Laravel

Route Groups are an important feature in Laravel. It allows you to perform some action on all grouped URLs. Routes Groups are good if you have to apply some attributes or properties on the URLs. It clubbed all the URLs in one and you can specify some rules and attributes to all at once, you do not need to apply attributes or rules to each route individually. There are multiple...
Routing in Laravel

Routing in Laravel

What Is a Route? Route is a way of creating a URL in Laravel. You can make as much as possible URL in Laravel and for that, you do not need to map URLs to specific files on a website. These URL is are both human-readable and SEO friendly In Laravel, routes are managed and created in the routes folder. If we need to make the URL for the website we...