Laravel Articles

Page 5 of 5

How to access images inside a public folder in Laravel?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 15-Mar-2026 33K+ Views

If you have an image stored in the public folder of Laravel, you can access or display it in the browser using various methods. In this article, we will learn some of these methods. Assume we have the image of a flower (flower.jpg) stored in the public/images folder as shown below ? Laravel Project Structure public/ images/ flower.jpg Now let us use the image to view inside the browser. Using url() Method The ...

Read More

How to get the server IP with Laravel?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 15-Mar-2026 7K+ Views

In Laravel, you can get the server IP address using the global $_SERVER['SERVER_ADDR'] variable or Laravel's built−in request methods. The server IP represents the IP address of the server hosting your application. The $_SERVER superglobal variable contains information about headers, paths, and script locations, including server details. Using $_SERVER['SERVER_ADDR'] The simplest method is to access the server IP directly from the $_SERVER superglobal ? 127.0.0.1 Using Laravel's Request Object Laravel provides the request() helper function with a server() method to access server variables ? ...

Read More

How to check if a Laravel collection is empty?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 15-Mar-2026 18K+ Views

Before checking if a Laravel collection is empty, let's understand what collections are in Laravel. Collection in Laravel is an API wrapper that helps you deal with different operations on arrays. It uses the class Illuminate\Support\Collection to handle arrays in Laravel. To create a collection from an array, use the collect() helper method that returns a collection instance. You can then chain methods like converting to lowercase and sorting on the collection. Installation: Make sure you have Laravel installed and create a controller using: php artisan make:controller UserController Using the isEmpty() Method The isEmpty() ...

Read More

How To Pass GET Parameters To Laravel From With GET Method?

Madushanka Chandrasekare
Madushanka Chandrasekare
Updated on 21-Feb-2025 304 Views

Introduction GET parameters passing in Laravel by forms is used in many web applications. GET parameters are most often used to filter data or even keep a search query after page transitions and to pass some information among pages. Having a good understanding of how to properly pass GET parameters to Laravel forms makes data handling smoother for better user experience.In this tutorial, different ways of passing GET parameters to Laravel forms through the GET method, with some best practices and actual examples, are discussed. Problem Statement The default method of Laravel forms is POST. However, when it comes to ...

Read More

Difference between Laravel Route::resource vs Route::controller

Tushar Khurana
Tushar Khurana
Updated on 12-Feb-2025 321 Views

Introduction When building a Laravel application, managing routes efficiently is crucial. Laravel provides various methods to define routes, and two commonly used approaches for handling resourceful controllers are Route::resource and Route::controller. While both help manage routes in a structured way, they have key differences in how they define and handle requests.In this article, we will explore the differences between Route::resource and Route::controller with an easy-to-understand table and examples. Key Differences Feature ...

Read More
Showing 41–45 of 45 articles
« Prev 1 2 3 4 5 Next »
Advertisements