jsdecena / laracom

Laravel FREE E-Commerce Software
https://jsdecena.github.io/laracom
1.91k stars 861 forks source link

[fix] db:seed failed issues #297

Closed ashraf789 closed 1 year ago

ashraf789 commented 1 year ago

Hi, @jsdecena First of all thanks for the nice project. I found some issues when running in my local related to db:seed which I have fixed and I hope this will make it easier for others.

Here are the details of my change

  1. my PHP version is 8.1 and I was getting this error. image

to fix it I updated the composer.json from

        "phpunit/phpunit": "~7.0"

to

       "phpunit/phpunit": "~7.0|~8.0"
  1. Laravel 8, the seeds directory was renamed to the seeders directory and need to add a namespace for each seeder class, therefore, sedding by the class was giving an error. image

I have renamed the seeds directory to seeders, added the namespace to each class namespace Database\Seeders; and updated composer.json autoload-dev

image

    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/",
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },    
  1. The fzaninotto/faker is deprecated a long ago and some function doesn't work like $faker->paragraph in database/factories/CategoryModelFactory.php

image i have changed fzaninotto/faker": "~1.4 to fakerphp/faker": "^1.21

image

Thanks Ashraf

jsdecena commented 1 year ago

nice @ashraf789 ! Haven't touched it for a while now and yes it is a big help to fix those namespace! Thanks!

ashraf789 commented 1 year ago

Hi, @jsdecena this pull request is waiting for your merge :)

jsdecena commented 1 year ago

Hi, @jsdecena this pull request is waiting for your merge :)

sorry, just waited for the unit tests to finish. all good now 👍🏽