Category

Laravel

How to remove public folder in url in laravel 10, 11 and Above versions

How to Remove “public” from URLs Laravel developers often face an issue where the public folder appears in their URLs. By default, Laravel serves the application through the public directory, but for clean and professional URLs, it’s essential to remove it. In this guide, we’ll explore how to properly remove the public folder from Laravel […]

Column not found: 1054 Unknown column ‘0’ in ‘field list’ – Laravel – I don’t have a 0 column

The error: Column not found: 1054 Unknown column ‘0’ in ‘field list’ occurs when Laravel or the underlying SQL query references a column that doesn’t exist in the database table. The specific mention of '0' suggests that either: Your query is trying to reference a column named 0, which doesn’t exist. A list of columns […]

How to exit outer foreach loop in laravel

To fetch records from two tables in Laravel and break the loop when a condition matches, you can use nested foreach loops. Here’s an example: Example: Fetch and Compare Records from Two Tables Explanation Fetching Data: Use DB::table('table_name')->get() to fetch data from both tables. Replace 'table1' and 'table2' with the actual table names. Nested Loops: […]

How to Set Meta(Title,Description,Keywords) in Layout file in Laravel livewire

In Laravel, To set meta tags (title, description, and keywords) dynamically in a Laravel Livewire layout file, follow these steps: Step 1. Define Meta Properties in the Livewire Component To add title, description, and keywords properties to your Livewire component and set default values or dynamically update them in the component’s logic. Example: 2. Pass […]

How to Run Migration Under a Folder in Laravel

In Laravel, if you want to use database tables you have to create migrations to make those tables. These migrations files are required to run migration commands to generate tables.Generally this migrations files are found under \Database\Migrations folder but some time if we are developing a project which have multiple sections and these sections may […]

How to Define Migration / Table name in model in Laravel

In Laravel, you need to define the table name related with a model by using the $table property within the model class. This is useful when the table does not created with the model. Following is the way of doing that. Example Suppose you have a table named custom_table that doesn’t follow Laravel’s naming convention. […]

How to check user is login or not in Laravel

if you want to check the user is logged in or not, you can use the Auth facade or the auth() helper function. Here’s how you can do it: 1. Use the Auth Facade The Auth::check() method returns true if the user is logged in, and false if the user is not logged in. 2. […]

How to get inserted Records ID / Column Data after inserting data in tables in Laravel

In Laravel, when you plan to insert new record into the database table, you can get the ID or any other column’s value of the inserted record using some different methods.Following are some of the approaches: 1. Use create() Method with Eloquent Model If you use create() method to insert a record,you can easily get […]

Custom Login and Registration in Laravel

In this post i am going to tell you how can we make custom login and registration in Laravel so first i need to create a registration page.For that, i need to create a blade file called registration.blade.php  and this file will be created under resources > views registration.blade.php New, create a another file called login.blade.php […]

How to Remove public folder from the URL in Laravel

In this post I am going to tell you how can we remove public folder which comes in the URL of Laravel website when it is used to upload on web hosting.To remove this folder, there are 2 ways.1st one is to update some code into .htaccess file of hosting so following is the code […]