您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
创建数据迁移错误集:
错误描述1:
[ErrorException] include(F:\phpStudy\WWW\blog\vendor\composer/../../database/migrations/2017_09_06_132637_create_ads_table.php): failed to open stream: No such file or directory
在此错误之前使用php artisan make:migration create_ads_table命令(命令1)执行并创建成功,后来问了与创建数据模型一致就想到用php artisan make:model Ad --migration命令(命令2),所以把已有迁移文件及数据库追踪数据表删除,在执行命令2时产生错误。
解决方法:执行以下3个命令
第一步、 php artisan cache:clear //清楚缓存
F:\phpStudy\WWW\blog>php artisan cache:clear Cache cleared successfully.
第二步、composer dump-autoload-o
F:\phpStudy\WWW\blog>composer dump-autoload -o Generating optimized autoload files
第三步、composer update
F:\phpStudy\WWW\blog>composer update Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 0 installs, 22 updates, 0 removals - Updating symfony/css-selector (v3.3.5 => v3.3.8): Downloading (100%) - Updating symfony/polyfill-mbstring (v1.4.0 => v1.5.0): Loading from cache - Updating symfony/var-dumper (v3.3.5 => v3.3.8): Downloading (100%) - Updating symfony/routing (v3.3.5 => v3.3.8): Downloading (100%) - Updating symfony/process (v3.3.5 => v3.3.8): Downloading (100%) - Updating symfony/http-foundation (v3.3.5 => v3.3.8): Downloading (100%) - Updating symfony/event-dispatcher (v3.3.5 => v3.3.8): Downloading (100%) - Updating symfony/debug (v3.3.5 => v3.3.8): Downloading (100%) - Updating symfony/http-kernel (v3.3.5 => v3.3.8): Downloading (100%) - Updating symfony/finder (v3.3.5 => v3.3.8): Downloading (100%) - Updating symfony/console (v3.3.5 => v3.3.8): Downloading (100%) - Updating ramsey/uuid (3.6.1 => 3.7.0): Loading from cache - Updating symfony/translation (v3.3.5 => v3.3.8): Downloading (100%) - Updating league/flysystem (1.0.40 => 1.0.41): Loading from cache - Updating laravel/framework (v5.4.30 => v5.4.36): Downloading (100%) - Updating fzaninotto/faker (v1.6.0 => v1.7.1): Loading from cache - Updating nikic/php-parser (v3.0.6 => v3.1.1): Downloading (100%) - Updating psy/psysh (v0.8.10 => v0.8.11): Loading from cache - Updating phpdocumentor/reflection-docblock (3.2.0 => 4.1.1): Downloading (100%) - Updating phpspec/prophecy (v1.7.0 => v1.7.2): Downloading (100%) - Updating phpunit/php-token-stream (1.4.11 => 2.0.1): Downloading (100%) - Updating symfony/yaml (v3.3.5 => v3.3.8): Downloading (100%) Writing lock file Generating optimized autoload files > Illuminate\Foundation\ComposerScripts::postUpdate > php artisan optimize Generating optimized class loader The compiled services file has been removed.
以上三步执行完,再次执行命令2即可成功创建模型与迁移文件。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。