How to Check If File Exists Using Laravel
In this article, we will discuss 3 ways to check if a file exists using Laravel’s functionalities. Storage Facade Let’s start off with the Storage Facade which is part of the Laravel filesystem. It...
In this article, we will discuss 3 ways to check if a file exists using Laravel’s functionalities. Storage Facade Let’s start off with the Storage Facade which is part of the Laravel filesystem. It...
In this article, we will discuss how to get the current URL inside Blade templates. We can use the request() global helper function or the Request helper Class. In conclusion, getting the...
Let’s quickly look at how we can set variables in Blade templates. Here we have some simple HTML where we output the name John Doe. But we want to store this name inside a...
Let’s quickly look at how we can use the ternary operator in Blade templates. Here we have a simple good old if/else statement. If the login route exists, display ‘Yes’; if it doesn’t, display...
Let’s look at how we can check if a route exists in a Laravel project. We’re going to use the has() method from the Route facade. Note that it tries to find the...
Let’s imagine the following scenario. You’re working on a monolith or a macroservice project. And a mobile app developer comes to you and says: – Hey, can you help me debug this API endpoint?...
Let’s look at 3 simple methods to check if debug mode is enabled in a Laravel project. Check .env file Let’s start with the first and the most obvious one. Open the...
Let’s look at how we can get the raw SQL query from an Eloquent Model and Query Builder in just a few steps. Get raw SQL query from an Eloquent Model Here we...
Let’s have a look at several ways you can check and get the Laravel version your app is using. Check Laravel version via CLI Check Laravel version via PHP Using Application::VERSION is faster because...
With the release of Laravel 9.32, dd() and dump() functions’ output has been improved. They are now showing the source file and the line where they’re called. This is super helpful if...