0

我正在使用 Laravel 5.2 版和 Jenssegers MongoDB。我安装了两者并且工作正常,但我必须使用任何其他库并在使用命令composer update之后在 composer.json 中进行更改。使用此命令后自动将 Jenssegers MongoDB 文件删除。我不知道为什么会这样。作曲家更新后为什么自动删除 Jenssegers MongoDB 文件?请建议我如何处理这个?

我的 composer.json 文件

    {
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*",
        "acacha/admin-lte-template-laravel": "2.*"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "symfony/css-selector": "2.8.*|3.0.*",
        "symfony/dom-crawler": "2.8.*|3.0.*"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        },
        "files": [
            "app/common_helper.php"
        ]
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}
4

2 回答 2

0

"jenssegers/mongodb": "*",在您的 composer.json 文件中写下这一行:-

"require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*",
        "acacha/admin-lte-template-laravel": "2.*",
        "jenssegers/mongodb": "*",
},

并将服务提供者添加到config/app.php

Jenssegers\Mongodb\MongodbServiceProvider::class,
Jenssegers\Mongodb\Auth\PasswordResetServiceProvider,

然后转到终端中的项目根目录并运行命令composer update

在模型文件中,您需要在顶部添加以下行,

use Jenssegers\Mongodb\Eloquent\Model as Eloquent; 

参考:-文档

于 2016-06-28T05:33:23.093 回答
0
composer update --no-scripts

你可以停止脚本运行

于 2016-06-28T08:45:37.330 回答