Việc cần giải quyết
Chào các bạn
Mình đang tìm sự hỗ trợ của mọi người.
Mình đang cài nWidart / laravel-modules vào ứng dụng Laravel của mình. Vấn đề phát sinh sau khi mình tạo một Module và tiến hành chạy lệnh migrate.
php artisan module:make Blog
php artisan migrate
Rất mong mọi người chỉ cách giải quyết giùm mình.
Nội dung lỗi
Chương trình trả về lỗi sau khi chạy migrate như sau:
D:\_dev\test>php artisan migrate
Illuminate\Contracts\Container\BindingResolutionException
Target class [Illuminate\Database\Eloquent\Factory] does not exist.
at D:\_dev\test\vendor\laravel\framework\src\Illuminate\Container\Container.php:879
875▕
876▕ try {
877▕ $reflector = new ReflectionClass($concrete);
878▕ } catch (ReflectionException $e) {
➜ 879▕ throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e);
880▕ }
881▕
882▕ // If the type is not instantiable, the developer is attempting to resolve
883▕ // an abstract type such as an Interface or Abstract Class and there is
1 [internal]:0
Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(Modules\Attendance\Providers\AttendanceServiceProvider))
2 D:\_dev\test\vendor\laravel\framework\src\Illuminate\Container\Container.php:877
ReflectionException::("Class Illuminate\Database\Eloquent\Factory does not exist")
Phương án đã thử
Mình đã thử xóa project và cài lại laravel từ đầu, nhưng lỗi trên vẫn xảy ra.
Trả lời
Mình thử thay đổi thứ tự chạy lệnh, tiến hành migrate trước để app cài các table mặc định vào db, sau đó mới chạy lệnh cài laravel-modules thì lỗi trên không xảy ra nữa. Lucky!