bagisto / laravel-data-faker

Creates fake data of products and customers for testing
MIT License
22 stars 23 forks source link

categories fake data #28

Closed MohamedAbdElghani closed 8 months ago

MohamedAbdElghani commented 1 year ago

Class Database\Factories\Webkul\Category\Models\CategoryTranslationFactory not found

jitendra-webkul commented 1 year ago

Please use the Bagisto master

abdallahnasar commented 1 year ago

Please use the Bagisto master

Hello I am facing the same issue, although using Bagisto master.

abdallahnasar commented 1 year ago

Hello,

I tried solving the issue as I didn't find CategoryTranslationFactory class even in the vendors directory, so as a workaround I created file: CategoryTranslationFactory.php at {base_dir}/database/factories/Webkul/Category/Models/CategoryTranslationFactory.php (with creating folders for Webkul, Category, Models ) to apply psr-4 autoloading standards: with the below code:

`<?php namespace Database\Factories\Webkul\Category\Models;

use Illuminate\Database\Eloquent\Factories\Factory; use Webkul\Category\Models\CategoryTranslation;

class CategoryTranslationFactory extends Factory {

protected $model = CategoryTranslation::class;

public function definition()
{
    return [
        'locale'                       => 'en',
        'name'                        => $this->faker->word,
    ];
}

} `

then run: composer dump-autoload php artisan optimize:clear

and then everything works fine