Archive

Author: Ravindra Kumar

Ravindra is a passionate full stack developer and dedicated blogger with a flair for crafting user-friendly web applications and insightful articles. With expertise spanning front-end and back-end technologies, Ravindra brings ideas to life through innovative coding solutions.

How to check first record in Laravel blade file

Here’s how to check the first iteration in a Blade @foreach loop: You can use Laravel’s built-in $loop variable: Explanation: {{ $loop->first ? 'active' : '' }}: Adds the active class only to the first item. aria-selected="{{ $loop->first ? 'true' : 'false' }}": Ensures accessibility for tab behavior. Let me know if you also want […]

How to redirect http to https in IIS

o redirect HTTP to HTTPS in IIS (Internet Information Services), you have a few options depending on your setup. Here’s how to do it step-by-step: Method 1: Using IIS HTTP Redirect Module This works best for simple websites and requires the HTTP Redirect feature to be installed. Steps: Open IIS Manager. Select your website from […]

How to redirect non-www to www in htaccess file

To redirect non-www to www using your .htaccess file, add the following code: Combined with HTTP to HTTPS redirect If you also want to force HTTPS and redirect non-www to www, here’s a combined version: OR (More optimized version with both conditions combined) Replace example.com with your actual domain name: Notes: The [NC] flag makes […]

How to redirect http to https in htacccess file

To redirect all HTTP traffic to HTTPS using .htaccess, you can use the following code snippet: Steps: Locate the .htaccess file in the root directory of your website (often public_html/). If there is no .htaccess file, create one. Paste the above code at the top of the file. Save the file and upload it if […]

Class ‘Intervention\Image\ImageServiceProvider’ not found in Laravel

The error “Class ‘Intervention\Image\ImageServiceProvider’ not found” in Laravel usually occurs when the Intervention Image package is not properly installed or configured. Steps to Fix: 1. Install Intervention Image Package Run the following command to install the package via Composer: 2. Check config/app.php (For Laravel <= 5.4) If you’re using Laravel 5.4 or earlier, manually add […]

How to convert String to Lower and Upper case in Laravel blade file

In a Laravel Blade file, you can convert a string to lowercase or uppercase using PHP functions directly in the Blade syntax. Convert to Lowercase Use the strtolower() function: Convert to Uppercase Use the strtoupper() function: Using Laravel’s Str Helper Laravel provides a Str helper, which is more flexible: Lowercase using Str::lower() Uppercase using Str::upper() […]

How to make separate route files in Laravel

In Laravel, you can create separate route files to organize your routes better. Here’s how you can do it: Step 1: Create a New Route File You can create additional route files inside the routes/ directory. For example: Admin Routes → Create routes/admin.php API Routes → Create routes/custom_api.php User Routes → Create routes/user.php Step 2: […]

How to increase phpmyadmin import file size in xampp localhost

To increase the PHPMyAdmin import file size in XAMPP on your localhost, follow these steps: Step 1: Modify php.ini Open XAMPP Control Panel. Click Config next to Apache and select PHP (php.ini). Find and update the following values: (You can set 100M or a larger value based on your needs.) Step 2: Modify config.inc.php (Optional) […]

How to assign a user ID to a guard in Laravel

1. Ensure Guard is Defined in auth.php In config/auth.php, make sure the college guard is properly configured: 2. Log In User with Guard To manually authenticate a user under the college guard, use: 3. Retrieve Logged-in User Once authenticated, you can retrieve the user ID using: $userId = Auth::guard(‘college’)->user()->id; 4. Logout the User To log […]

Setup separate layouts for the frontend and for the admin panel in your Laravel Livewire project

1. Define Frontend & Admin Layouts in Blade Templates Ensure your resources/views/layouts folder has these two layout files: resources/views/layouts/app.blade.php (Frontend Layout) resources/views/layouts/admin-app.blade.php (Admin Layout) 2. Use Layouts in Livewire Components In Livewire components, you can specify which layout to use by updating the render method. Frontend Livewire Component Example For frontend components, use app.blade.php: public […]