Have you tried composer dump-autoload?
Oct 14, 2020
13
Level 9
>>> use App\{User,BookingEvent,BookingService} >>> BookingEvent::factory()->count(3)->for(BookingService::factory())->create(); PHP Error: Class 'Database/Factories/BookingEventFactory' not found in C:/laragon/www/acl/vendor/laravel/framework/src/Illumin
In my laravel project having version 8.9.0. I'm trying to run factory command but this show this kind of error in tinker terminal
λ php artisan tinker
Psy Shell v0.10.4 (PHP 7.4.8 — cli) by Justin Hileman
>>> use App\{User,BookingEvent,BookingService}
>>> BookingEvent::factory()->count(3)->for(BookingService::factory())->create();
PHP Error: Class 'Database/Factories/BookingEventFactory' not found in C:/laragon/www/acl/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factories/Factory.php on line 656
can anyone tells me what I did wrong. THis is my factory class method BookingEventFactory
<?php
namespace Database\Factories;
use App\BookingEvent;
use App\BookingService;
use Illuminate\Database\Eloquent\Factories\Factory;
class BookingEventFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = BookingEvent::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'event_name' => $this->faker->name,
'user_id' => 2,
'booking_service_id' => BookingService::factory(),
'duration' => '1 Hours',
'price' => '1000',
'event_description' => $this->faker->paragraph,
];
}
}
Level 102
Yeah! And remove the package :)
https://github.com/laravel/laravel/blob/master/composer.json#L38
Please or to participate in this conversation.