Click here to Skip to main content
14,880,672 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good afternoon. I am working on a major laravel application and I have now been stuck for hours at the following problem:
basically I had all the seeders in the DatabaseSeeder.php file and I separated them into their own seeder files to make it easier to work on it but now I am getting the error mentioned in the title when trying to run the seeders. I have been researching about it and most of the cases happen at launch time but in my case I am getting this error in the console when trying to seed the database. I know that it is a problem with xdebug but I have increased the limit up to 1000 and it is still not enough. When seeding the database it seems to repeat several times the same seeder as I have seen in the console. I am not able to find the problem, any help is much appreciated. Down below is the code of my database seeder and the console output.

PHP
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
        $this->call([
            AddressSeeder::class,
            CartSeeder::class,
            CategorySeeder::class,
            DatabaseSeeder::class,
            ImageSeeder::class,
            ProductDetailSeeder::class,
            ProductPropertySeeder::class,
            ProductSeeder::class,
            ProductSummarySeeder::class,
            ProvinceSeeder::class,
            ReviewSeeder::class,
            UserSeeder::class
        ]);
    }
}


C:\Users\Kevin\Desktop\Projects\welager>php artisan migrate:fresh --seed
Dropped all tables successfully.
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table (98.49ms)
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table (81.18ms)
Migrating: 2014_10_12_200000_add_two_factor_columns_to_users_table
Migrated: 2014_10_12_200000_add_two_factor_columns_to_users_table (28.35ms)
Migrating: 2019_08_19_000000_create_failed_jobs_table
Migrated: 2019_08_19_000000_create_failed_jobs_table (133.99ms)
Migrating: 2019_12_14_000001_create_personal_access_tokens_table
Migrated: 2019_12_14_000001_create_personal_access_tokens_table (139.50ms)
Migrating: 2020_10_24_221000_create_categories_table
Migrated: 2020_10_24_221000_create_categories_table (66.57ms)
Migrating: 2020_10_25_211948_create_sessions_table
Migrated: 2020_10_25_211948_create_sessions_table (271.03ms)
Migrating: 2020_10_25_214937_create_products_table
Migrated: 2020_10_25_214937_create_products_table (177.20ms)
Migrating: 2020_10_25_230729_create_images_table
Migrated: 2020_10_25_230729_create_images_table (49.78ms)
Migrating: 2020_12_01_025900_create_product_details_collection
Migrated: 2020_12_01_025900_create_product_details_collection (0.38ms)
Migrating: 2020_12_03_204319_create_reviews_table
Migrated: 2020_12_03_204319_create_reviews_table (57.17ms)
Migrating: 2020_12_05_180730_create_carts_table
Migrated: 2020_12_05_180730_create_carts_table (59.37ms)
Migrating: 2020_12_05_181734_create_cart_items_table
Migrated: 2020_12_05_181734_create_cart_items_table (47.30ms)
Migrating: 2021_01_03_225738_create_addresses_table
Migrated: 2021_01_03_225738_create_addresses_table (111.77ms)
Migrating: 2021_01_16_223543_create_provinces_table
Migrated: 2021_01_16_223543_create_provinces_table (60.62ms)
Migrating: 2021_01_25_211402_create_product_details_table
Migrated: 2021_01_25_211402_create_product_details_table (50.63ms)
Migrating: 2021_01_25_212124_create_product_summaries_table
Migrated: 2021_01_25_212124_create_product_summaries_table (72.72ms)
Migrating: 2021_01_25_213224_create_product_properties_table
Migrated: 2021_01_25_213224_create_product_properties_table (49.63ms)
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (9.88ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (7.78ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (79.86ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (6.77ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (5.53ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (70.73ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (5.93ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (6.88ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (68.07ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (5.24ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (4.75ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (61.21ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (6.66ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (4.87ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (63.13ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (6.73ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (5.18ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (101.28ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (5.59ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (5.22ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (58.30ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (5.03ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (6.33ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (58.65ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (5.33ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (4.52ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (60.36ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (5.02ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (4.66ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (59.00ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (5.65ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (5.08ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (55.98ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (5.60ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (4.97ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (55.86ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (6.00ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (5.90ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (55.29ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (4.98ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (5.32ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (58.20ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (6.20ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (5.87ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (97.20ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (5.88ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (5.55ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (104.18ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (6.18ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (7.11ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (62.00ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (6.50ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (4.42ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (63.47ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (6.21ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (5.18ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (56.53ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (5.72ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (5.53ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (58.10ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (6.38ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (6.87ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (68.18ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (5.32ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (5.14ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (62.00ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (54.25ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (43.68ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (103.68ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (10.41ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (4.36ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (59.51ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder
Seeded: Database\Seeders\AddressSeeder (5.12ms)
Seeding: Database\Seeders\CartSeeder
Seeded: Database\Seeders\CartSeeder (5.09ms)
Seeding: Database\Seeders\CategorySeeder
Seeded: Database\Seeders\CategorySeeder (56.87ms)
Seeding: Database\Seeders\DatabaseSeeder
Seeding: Database\Seeders\AddressSeeder

Error

Maximum function nesting level of '256' reached, aborting!

at C:\Users\Kevin\Desktop\Projects\welager\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:1188
1184▕ *
1185▕ * @param string $service
1186▕ * @return bool
1187▕ */
➜ 1188▕ public function isDeferredService($service)
1189▕ {
1190▕ return isset($this->deferredServices[$service]);
1191▕ }
1192▕

1 C:\Users\Kevin\Desktop\Projects\welager\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:837
Illuminate\Foundation\Application::isDeferredService("config")

2 C:\Users\Kevin\Desktop\Projects\welager\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:824
Illuminate\Foundation\Application::loadDeferredProviderIfNeeded("config")

What I have tried:

I have tried to raise the limit on xdebug but still the same
Posted
Updated 31-Jan-21 10:57am
Comments
oLiontas 31-Jan-21 16:23pm
   
Looks like you have an infinite recursion.
Member 14153150 31-Jan-21 16:25pm
   
do you know what could be causing it?
Dave Kreskowiak 31-Jan-21 16:46pm
   
You have a function, or chain of functions, calling themselves without any way for the code to bail out of this loop.

The only way you're going to determine this is debugging the code.

1 solution

Problem solved. I just called DatabaseSeeder inside itself and that was causing a recursion
   
Comments
Patrice T 31-Jan-21 17:14pm
   
Accept your own solution, it will close the question as Solved.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900