Is there any other approach to update or chunk to populate a new column with millions rows?

My query is taking too long to run when I use general filters, but it’s fine with specific filters. I suspect it’s an optimization issue.

To fix it, I’m trying to create a non-clustered index on a new column. This column will extract a specific value from a JSON attributes column.

The table has over 2 million rows. I ran the migration and it created the new column instantly, but it’s hanging indefinitely while trying to populate the data. I’m also planning to create a composite index on three columns, including this new one.

What is the best way to backfill a column on a large table without causing the migration to fail or hang?

<?php

use IlluminateDatabaseMigrationsMigration;
use IlluminateDatabaseSchemaBlueprint;
use IlluminateSupportFacadesSchema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('answer_tests', function (Blueprint $table) {
            $table->BigInteger('unity_id')->after('institution_id')->nullable();
        });

        DB::table('answer_tests')->orderBy('id')->chunkById(100, function ($rows) {
            foreach ($rows as $row) {
                DB::table('answer_tests')
                    ->where('id', $row->id)
                    ->update([
                        'unity_id' => DB::raw("JSON_UNQUOTE(JSON_EXTRACT(attributes, '$.class_school.unity.id'))"),
                    ]);
            }
        });

        Schema::table('answer_tests', function (Blueprint $table) {
            $table->index(['institution_id', 'unity_id', 'created_at'], 'idx_unity_institution_created_at');
        });

    }

    public function down(): void
    {
        Schema::table('answer_tests', function (Blueprint $table) {
            $table->dropIndex('idx_unity_institution_created_at');
            $table->dropColumn('unity_id');
        });
    }
};

laravel mail issue while using the laravel default mail template

I am using the Laravel default mail directory. The path is like this:
resources/views/vendor/mail/html/. This is a directory and I added two new custom email templates.

Inside the html directory I have the following blade files:

  1. email_promo.blade.php
  2. email_temp.blade.php
  3. message.blade.php

When I use the first two templates it is giving me this error:

View [vendor.mail.html.email_promo] not found.

View [vendor.mail.html.email_temp] not found.

But the default message.blade.php email template is working. Does anyone one know why it is saying that? I have cleared the view and checked if it’s case-senstive but it is the same as defined. Can anyone help with this?

I am expecting that the view error should not be generated.

E_COMPILE_ERROR [duplicate]

An error of type E_COMPILE_ERROR was caused in line 4238 of the file
/www/plusbyapn_925/public/wp-content/themes/plusbyapn/functions.php.
Error message: Cannot redeclare plus_typeform() (previously declared
in
/www/plusbyapn_925/public/wp-content/themes/plusbyapn/functions.php:4204)

I checked functions.php but I don’t see any redeclaration there.

How can I remove duplicated and non categorized pages on google search? [closed]

I have made a real estate website for a company I work for using the yii2 framework. Google search console have found many variations of links and marked them as duplicate or chose not to categorize them at all. What can I do to make them categorized or point to the main page of each duplicated url?
I will provide some info on how these urls got produced in the first place:

  • Yii2 framework on its own make variations of the urls according to how many languages you have set.
  • In real estate search page, if you choose any of the filters available, the url changes dynamically. Considering that we have many filters this can produce a large amount of urls.
  • We have a large amount of properties, each property id with its own url.

Here is examples of the flags of google search console:

  1. Duplicated:
    https://goldenhome.gr/?sort=-AskedValue&page=967 (actually non-existent. This parameter should only exist in the search page)
    https://goldenhome.gr/property/view/320943 (property sold page)
    https://goldenhome.gr/epikoinwnia / https://goldenhome.gr/contact-us (greek and english page)
    https://goldenhome.gr/property/view/324726?language=el (auto generated lang parameter)
    https://goldenhome.gr/property/view?id=466676

iframe to PHP file is downloading instead of displaying, can I display PHP inside an HTML iframe? [duplicate]

I’m developing a webpage that uses strictly PHP files because it’s a lot of repetition and I wanted to use templates for my files. Unfortunately GitHub doesn’t display PHP files like it does for HTML files so I wanted to try to use an HTML file to bypass this restriction. However, when I used an iframe to try to display the PHP files, it downloaded the file instead.

I have tried the methods shown in question 20276613 – using php inside of iframe html tags and question 50949201 – iframe downloads the html source instead of displaying it. This resulted in my HTML code looking like this:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <iframe align="center" width="100%" height="100%" src="pages/index.php" frameborder="yes" scrolling="yes" name="myIframe" id="myIframe"> </iframe>
</body>
</html>

which unfortunately did not work.

Upon typing this question, I was prompted with questions 35207934 – PHP file downloading instead of displaying files and 32143755 – chrome is downloading file in iframe instead of displaying it, neither of which helped nor were relevant.

If it matters (which I think it does) I have tried this on Opera, Opera GX, Opera Air, Google Chrome, and Microsoft Edge, all most recent versions, and I am running Windows 11 Home 24H2 64x.

Is there any way I can fix this? Should I have used a different approach instead of using PHP for everything?

Thank you.

Is it possible to get metadata (specifically the original creation date or time) from a .pdf that was emailed to me as an attachment in PHP?

I have many .pdf files from attachments that were emailed to me by police and court of apeal (not shared via FTP) and I have the old HDD blocked so that I had to download them in same day and creation date is same with modification date, so I was wondering if it was possible to find out the date and/or time it was originally created after they are shared in a private ftp folder and listed in php? Everything I’ve tried to date just gives me the date/time that I download the attachment. All the files are smaller then 10MB so that I would need just a line of code to read the /CreationDate entry via file_get_contents() and not a class or an API with tons of files and bytes.

<?php 

    $date = array(); $sourcefile = "./file.pdf";
    $stringedPDF = file_get_contents($sourcefile, true);

    preg_match('/(?<=CreationDate )S(?:(?<=().+?(?=))|(?<=[).+?(?=]))./', $stringedPDF, $date);
    echo $all = $date[0];

Best way to automate SQL dump to CodeIgniter 4 migrations? [closed]

I’m working on a project where I need to convert SQL dump files (e.g., from phpMyAdmin) into CodeIgniter 4 migration files, including foreign keys and triggers. Manually writing migrations is inefficient, especially with complex schemas. Are there tools or best practices for this? I’ve started a GitHub project to address this—any feedback or suggestions?

I started by manually converting a SQL dump file (e.g., from phpMyAdmin) into CodeIgniter 4 migration files using the Forge class, defining tables and foreign keys like user_id with ON DELETE SET NULL. However, this process is time-consuming, especially with complex schemas involving triggers and multiple tables. I explored existing tools like CodeIgniter’s migration system and third-party libraries, but none fully automate the conversion of SQL dumps while preserving foreign key actions (e.g., SET NULL, NO ACTION) and triggers.

I attempted to write a custom script using PHP to parse the SQL file and generate migration code, but handling edge cases (e.g., multi-line SQL, non-standard syntax) proved challenging. I expected a more efficient solution that could read a SQL file, extract table structures, foreign keys, and triggers, and output ready-to-use CodeIgniter 4 migration files with minimal manual adjustment. To address this, I’ve begun developing a GitHub project to automate this process, but I’d like to know if there are better approaches or tools I might have missed.

Admin Toolbar Not Showing on All Pages After Restoring WordPress Backup [closed]

I recently restored my WordPress site to a previous backup (dated yesterday). After the restoration:

The admin toolbar is missing on the homepage.

After some time, it disappeared on all pages of the site.

I am logged in as an administrator, and other admin functionalities are working.

Here are my current environment details:

WordPress version: 6.x.x

PHP version: 8.x

Active theme: Woodmart (premium)

Active plugins: Elementor Pro, Dokan Pro, WooCommerce, LiteSpeed Cache, WPForms Lite, and others.

Cache / CDN: LiteSpeed Cache + Cloudflare (if relevant)

Cleared browser cache and cookies.

Deactivated all plugins → still no admin toolbar.

Switched to default theme (Twenty Twenty-Three) → admin toolbar appeared.

Checked user roles → administrator.
Why is the admin toolbar missing after restoring the backup?
How can I make it appear again on all pages without affecting the site?

Does Bit Flows Pro limit either the number of nodes executed in a single flow or the maximum duration?

Bit Flows Pro flow stops early (~20–21s) with fewer nodes than expected on WordPress (OpenLiteSpeed + lsphp). Where is the timeout coming from and how do I raise it?

Environment

  • WordPress + Bricks Builder
  • JetEngine (CCTs + Relations), JetFormBuilder (form + repeater)
  • Bit Flows Pro (flows triggered by webhook)
  • RunCloud server running OpenLiteSpeed with lsphp 8.1 (not PHP-FPM)

What the flow does

A JetFormBuilder form creates 4 CCTs of type “contatos” (x1), “atribuicoes” (x2) and “interacoes” (x1).
Then it sends a webhook to Bit Flows Pro with a repeater array so the flow can create N extra CCTs of type “interacoes“ and all the relations between them. The N extra CCTs and the connections they require are created with Rest API requests.

What I tried

Each repeater item equals a “cycle” of 6 nodes (create interacao, 5 relations).
With the 2 “intro” nodes at the start, a run with 2 items on the repeater should end with 14 nodes. A run with 3, with 20 nodes and so on.

If I have 3 items on the repeater, everything works fine, with the run ending with 20 nodes at around 19-20s. When I try to add a fourth item do the repeater, the run ends early with around 21 nodes, status SUCCESS, and duration ~19–21s.

The logs show no errors, both the Bit Flows Pro logs and the WP debug log.

What I suspect

A hard timeout based on the number of nodes or on ~20s (runner/job timeout) is aborting the flow before the final node(s), even though the flow UI shows “SUCCESS”.

Bit Flows Pro log inside the flow

Flow I built

Expected 2 arguments. Found 1.intelephense(P1005) [closed]

Good evening,

I am a beginner in web developpement and I am stuck beacause when i write thoses lines :

$produit->setCategorie($this->getReference(CategorieFixtures::INFORMATIQUE));

$produit->setCategorie($this->getReference(CategorieFixtures::ELECTROMENAGER));

There is always a red line saying that it expect 2 arguments and I only have one.

On the Online courses it works, but on my computer nothing.

And when I try this commande on my Terminal : php bin/console doctrine:fixtures:load

it says :

Too few arguments to function
DoctrineCommonDataFixturesAbstractFixture::getReference(), 1 passed
in
C:xampphtdocssymfony-sitewebsrcDataFixturesProduitFixtures.php
on line 17 and exactly 2 expected

I hope I was clear.

Here is a picture of my code :
enter image description here

I tried to install the vers 1.2.3 version of PHP but it still did not worked. Even after I reboot my VSCODE.

Then I tried to put in false all the “intelephense” on the JSON file. I rebooted my VSCODE still nothing.

And I tried to empty the cache, then I rebooted my VSCODE and nothing works.

PHP Help Regisiter with image upload

I’m trying to integrate an image upload into the customer add area that will also be saved in the database with the name + uploaded to the folder, I managed to save it in the database but I can’t get it to upload. Can someone tell me what’s wrong? Thanks

Upload form

                                <div class="form-group row m-b-20">
                                    <div class="col-12">
                                        <form enctype="multipart/form-data" method="POST" action="test2.php">
                                        <label for="password">Carte Auto</label>
                                        <input type="file" id="file" name="file" required="true" placeholder="Carte Auto">
                                    </div>
                                </div>

Client add .php

<?php  
session_start();
error_reporting(0);
include('includes/dbconnection.php');
if (strlen($_SESSION['adid']==0)) {
  header('location:logout.php');
  } else{

?>

<?php 
session_start();
error_reporting(0);
include('includes/dbconnection.php');
if(isset($_POST['submit']))
  {
    $fname=$_POST['fullname'];
    $mobno=$_POST['mobilenumber'];
    $email=$_POST['email'];
    $password=md5($_POST['password']);
    $marca=$_POST['marca'];
    $model=$_POST['model'];
    $km=$_POST['km'];
    $servizio=$_POST['servicedate'];
    $carte=$_POST['file'];

    $ret=mysqli_query($con, "select Email from tbluser where Email='$email' || MobileNo='$mobno'");
    $result=mysqli_fetch_array($ret);
    if($result>0){
$msg="Questo indirizzo email o numero di contatto è già associato a un altro account";
    }
    else{
    $query=mysqli_query($con, "insert into tbluser(FullName, MobileNo, Email, Password, CarModel, CarMarca, CarKM, servizio, carte) value('$fname', '$mobno', '$email', '$password', '$marca', '$model', '$km', '$servizio', '$carte')");
    if ($query) {
    $msg="Il cliente si è registrato con successo";
  }
  else
    {
      $msg="Qualcosa è andato storto. Riprova.";
    }
}
}
 ?>
<!doctype html>
<html lang="en">

    <head>
        <meta charset="utf-8" />
        <title>ALL-IN GARAGE SERVICE</title>
        <!-- App css -->
        <link href="../assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="../assets/css/icons.css" rel="stylesheet" type="text/css" />
        <link href="../assets/css/metismenu.min.css" rel="stylesheet" type="text/css" />
        <link href="../assets/css/style.css" rel="stylesheet" type="text/css" />

        <script src="../assets/js/modernizr.min.js"></script>

    </head>


    <body>

        <!-- Begin page -->
        <div id="wrapper">

          <?php include_once('includes/sidebar.php');?>
            <div class="content-page">
                 <?php include_once('includes/header.php');?>
                <!-- Start Page content -->
                <div class="content">
                    <div class="container-fluid">

                        <div class="row">
                            <div class="col-12">
                                <div class="card-box">
                                    <h4 class="m-t-0 header-title">ALL-IN GARAGE | aggiungere un cliente</h4>
                                    <p class="text-muted m-b-30 font-14">
                                       
                                    </p>

                                </a>
                            </h3>
                              <hr color="#000" />
                                                <p style="font-size:16px; color:red" align="center"> <?php if($msg){
    echo $msg;
  }  ?> </p>

                            <form class="form-horizontal" action="" name="signup" method="post" onsubmit="return checkpass();">

                                <div class="form-group row m-b-20">
                                    <div class="col-12">
                                        <label for="username">Nome</label>
                                        <input class="form-control" type="text" id="fullname"name="fullname" required="" placeholder="Inserisci il tuo nome completo">
                                    </div>
                                </div>

                                 <div class="form-group row m-b-20">
                                    <div class="col-12">
                                        <label for="username">Telefono</label>
                                        <input class="form-control" type="text" id="mobilenumber" name="mobilenumber" required="" placeholder="Inserisci il tuo numero di cellulare" maxlength="15" pattern="[0-9]+">
                                    </div>
                                </div>
                                

                                <div class="form-group row m-b-20">
                                    <div class="col-12">
                                        <label for="emailaddress">Auto Targa</label>
                                        <input class="form-control" type="text" id="email" name="email" required="" placeholder="Targa">
                                    </div>
                                </div>
                                
                                                                                                <div class="form-group row m-b-20">
                                    <div class="col-12">
                                        <label for="password">Marca dell'auto </label>
                                        <input class="form-control" type="text required="" id="marca" name="marca" placeholder="Modello di auto">
                                    </div>
                                </div>


                                <div class="form-group row m-b-20">
                                    <div class="col-12">
                                        <label for="password">Modello di auto</label>
                                        <input class="form-control" type="text" required="" id="model" name="model" placeholder="Marca dell'auto">
                                    </div>
                                </div>
                                
                                <div class="form-group row m-b-20">
                                    <div class="col-12">
                                        <label for="password">Scadenza revisione </label>
                                        <input class="form-control" type="date" required="" id="servicedate" name="servicedate" required="true" placeholder="Marca dell'auto">
                                    </div>
                                </div>
                                
                                <div class="form-group row m-b-20">
                                    <div class="col-12">
                                        <form enctype="multipart/form-data" method="POST" action="test2.php">
                                        <label for="password">Carte Auto</label>
                                        <input type="file" id="file" name="file" required="true" placeholder="Carte Auto">
                                    </div>
                                </div>
                                


                                <div class="form-group row text-center m-t-10">
                                    <div class="col-12">
                                        <button class="btn btn-block btn-custom waves-effect waves-light" type="submit" name="submit" >Aggiungi</button>
                                    </div>
                                </div>

                            </form>

                            <div class="row m-t-50">
                                <div class="col-sm-12 text-center">
                                </div>
                            </div>
   


</table>

                                                
                                            </div>
                                        </div>

                                    </div>
                                    <!-- end row -->

                                </div> <!-- end card-box -->
                            </div><!-- end col -->
                        </div>
                        <!-- end row -->
                    </div> <!-- container -->

                </div> <!-- content -->

             <?php include_once('includes/footer.php');?>
            </div>
        </div>
        <!-- jQuery  -->
        <script src="../assets/js/jquery.min.js"></script>
        <script src="../assets/js/bootstrap.bundle.min.js"></script>
        <script src="../assets/js/metisMenu.min.js"></script>
        <script src="../assets/js/waves.js"></script>
        <script src="../assets/js/jquery.slimscroll.js"></script>

        <!-- App js -->
        <script src="../assets/js/jquery.core.js"></script>
        <script src="../assets/js/jquery.app.js"></script>

    </body>
</html>
<?php }  ?>

test2.php ( upload php )

<?php
$allowedExts = array("gif", "jpeg", "jpg", "png");
$extension = end(explode(".", $_FILES["file"]["name"]));
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/jpg")
|| ($_FILES["file"]["type"] == "image/png"))
&& ($_FILES["file"]["size"] < 350000)
&& in_array($extension, $allowedExts))
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
    }
  else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br>";
    echo "Type: " . $_FILES["file"]["type"] . "<br>";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";

    if (file_exists("uploads/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "uploads/" . $_FILES["file"]["name"]);
      echo "Stored in: " . "uploads/" . $_FILES["file"]["name"];
      }
    }
  }
else
  {
  echo "Invalid file";
  }
?>

what is wrong there ? thanks

Symfony twig component

I use symfony multi app directory structure by this manual – https://symfony.com/doc/current/configuration/multiple_kernels.html
I want to use Twig component for each app, but i can’t rewrite component path to component template directory (anonymous_template_directory).
Whatever I do, my new path just added to base path.

base path (in twig_component.yaml) – anonymous_template_directory: ‘components/’
i try to set anonymous_template_directory:’kernel.project_dir%/website/templates/components/’

result: The “/var/www/html/templates//var/www/html/website/templates/components/” directory does not exist.

I would be grateful for help

Debugging ‘Max File Size Limit’ in Dockerized Dolibarr [closed]

I have a Dolibarr instance running inside Docker, with Nginx as a reverse proxy on the host. Here’s my setup:

docker-compose.yml

services:
    mariadb:
        image: mariadb:latest
        environment:
            MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
            MYSQL_DATABASE: ${MYSQL_DATABASE:-dolidb}
            MYSQL_USER: ${MYSQL_USER:-dolidbuser}
            MYSQL_PASSWORD: ${MYSQL_PASSWORD:-dolidbpass}

        restart: always
        volumes:
            - ./dolibarr_mariadb:/var/lib/mysql

    web:
        # Choose the version of image to install
        # dolibarr/dolibarr:latest (the latest stable version)
        # dolibarr/dolibarr:develop
        # dolibarr/dolibarr:x.y.z
        image: dolibarr/dolibarr:latest
        environment:
            DOLI_INIT_DEMO: ${DOLI_INIT_DEMO:-0}
            DOLI_DB_HOST: ${DOLI_DB_HOST:-mariadb}
            DOLI_DB_NAME: ${DOLI_DB_NAME:-dolidb}
            DOLI_DB_USER: ${DOLI_DB_USER:-dolidbuser}
            DOLI_DB_PASSWORD: ${DOLI_DB_PASSWORD:-dolidbpass}
            DOLI_URL_ROOT: "${DOLI_URL_ROOT:-http://0.0.0.0}"
            DOLI_ADMIN_LOGIN: "${DOLI_ADMIN_LOGIN:-admin}"
            DOLI_ADMIN_PASSWORD: "${DOLI_ADMIN_PASSWORD:-admin}"
            DOLI_CRON: ${DOLI_CRON:-0}
            DOLI_CRON_KEY: ${DOLI_CRON_KEY:-mycronsecurekey}
            DOLI_COMPANY_NAME: ${DOLI_COMPANY_NAME:-MyBigCompany}
            WWW_USER_ID: ${WWW_USER_ID:-1000}
            WWW_GROUP_ID: ${WWW_GROUP_ID:-1000}

        ports:
          - "127.0.0.1:8000:80"
        links:
            - mariadb
        volumes:
            - ./dolibarr_documents:/var/www/documents
            - ./dolibarr_custom:/var/www/html/custom
            - ./dolibarr_php:/usr/local/etc/php

        restart: always

php.ini inside Dolibarr container:

; https://php.net/upload-max-filesize
upload_max_filesize = 20M
; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20

Nginx config on the host:

server {
    listen 80;
    server_name dolibarr.local;

    location / {
            return 301 https://$host$request_uri;
    }
}

server {
    listen 443 ssl;
    server_name dolibarr.local;

    ssl_certificate /etc/nginx/certs/dolibarr.local.crt;
    ssl_certificate_key /etc/nginx/certs/dolibarr.local.key;

    client_max_body_size 20M;

    location / {
        proxy_pass http://127.0.0.1:8000;  
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

I am trying to upload files larger than the default limit, but it doesn’t work. I checked Nginx logs and the Dolibarr Docker logs, but nothing appears related to the issue.

how to create simple login system (admin & user) in Laravel 12 livewire starter kit? [closed]

i am learning laravel. as a beginner i am trying to create a simple login system in laravel 12 with livewire. system should redirect to the admin dashboard and user dashboard base on role. i have created AdminMiddleware and UserMiddleware.

AdminMiddleware

<?php

namespace AppHttpMiddleware;

use Closure; use IlluminateHttpRequest; use IlluminateSupportFacadesAuth; use SymfonyComponentHttpFoundationResponse;

class AdminMiddleware {
    /**
     * Handle an incoming request.
     *
     * @param  Closure(IlluminateHttpRequest):   (SymfonyComponentHttpFoundationResponse)  $next
     */
    public function handle(Request $request, Closure $next): Response
    {
        if (Auth::user() && Auth::user()->role != 'admin') {
            return redirect()->route('user.dashboard);
        }
        return $next($request);
    } }

UserMiddleware

<?php
    
    namespace AppHttpMiddleware;
    
    use Closure;
    use IlluminateHttpRequest;
    use IlluminateSupportFacadesAuth;
    use SymfonyComponentHttpFoundationResponse;
    
    class UserMiddleware
    {
        /**
         * Handle an incoming request.
         *
         * @param  Closure(IlluminateHttpRequest): (SymfonyComponentHttpFoundationResponse)  $next
         */
        public function handle(Request $request, Closure $next): Response
        {
            if (Auth::user() && Auth::user()->role != 'user') {
                return redirect()->route('admin.dashboard);
            }
            return $next($request);
        }
    }

web.php

<?php

use AppLivewireAdminAdminDashboard;
use AppLivewireEmployeeUserDashboard;
use AppLivewireSettingsAppearance;
use AppLivewireSettingsPassword;
use AppLivewireSettingsProfile;
use IlluminateSupportFacadesRoute;

Route::get('/', function () {
    return view('welcome');
})->name('home');

Route::view('dashboard', Dashboard::class)
    ->middleware(['auth', 'employee'])
    ->name('user.dashboard');

Route::middleware(['auth'])->group(function () {
    Route::redirect('settings', 'settings/profile');

    Route::get('settings/profile', Profile::class)->name('settings.profile');
    Route::get('settings/password', Password::class)->name('settings.password');
    Route::get('settings/appearance', Appearance::class)->name('settings.appearance');
});

Route::middleware(['auth', 'admin'])->group(function () {
    Route::view('admin/dashboard', AdminDashboard::class)->name('admin.dashboard');
    // Additional admin routes can be added here
});

require __DIR__ . '/auth.php';

i am getting error Route [dashboard] not defined.
because i have created AdminMiddleware and UserMiddleware to redirect the admin.dashboard and user.dashboard while default dashboard is there.

my question is

Should we create two separate middleware for admin and user, or is it
enough to have only one middleware for admin that redirects to
admin.dashboard, while regular users don’t need their own middleware
and instead use the default dashboard without requiring a separate
user middleware to redirect the route to user.dashboard?