【问题标题】:Laravel application fails to start after Composer updateComposer 更新后 Laravel 应用程序无法启动
【发布时间】:2016-07-15 15:37:02
【问题描述】:

使用composer update 更新作曲家后,我的应用程序现在无法启动。

php artisan -V的结果:

Laravel Framework version 4.1.19

错误信息:

ErrorException

Route [admin.profile.index] not defined. (View: /var/www/laravel/app/views/back_end/menu.blade.php) (View: /var/www/laravel/app/views/back_end/menu.blade.php) (View: /var/www/laravel/app/views/back_end/menu.blade.php)


ErrorException

Route [admin.profile.update] not defined. (View: /var/www/laravel/app/views/back_end/layouts/profile.blade.php)

我的路线:

Route::get('login', array('as'=>'login', function()
{
    return View::make('back_end.login');
}));
Route::group(array('before' => 'auth'), function()
{
  Route::resource('admin/profile' , 'ProfileController' , array('as'=>'profile' , 'before'=>'csrf'));
});

composer.json内容:

{
        "name": "laravel/laravel",
        "description": "The Laravel Framework.",
        "keywords": ["framework", "laravel"],
        "license": "MIT",
        "require": {
                "laravel/framework": "4.1.*",
                "way/generators": "dev-master"
        },
        "autoload": {
                "classmap": [
                        "app/commands",
                        "app/controllers",
                        "app/models",
                        "app/database/migrations",
                        "app/database/seeds",
                        "app/tests/TestCase.php"
                ]
        },
        "scripts": {
                "post-install-cmd": [
                        "php artisan clear-compiled",
                        "php artisan optimize"
                ],
                "post-update-cmd": [
                        "php artisan clear-compiled",
                        "php artisan optimize"
                ],
                "post-create-project-cmd": [
                        "php artisan key:generate"
                ]
        },
        "config": {
                "preferred-install": "dist"
        },
        "minimum-stability": "stable"
}

配置文件控制器:

class ProfileController extends \BaseController {

    public $layout = 'back_end.layouts.main';
    public function index()
    {
        $profiles = Auth::user();
        return  View::make('back_end.layouts.profile')->with('profile', $profiles);
    }
}

在更新之前,我的应用程序运行正常,没有任何问题。

【问题讨论】:

  • 尝试在 laravel 项目根文件夹上 composer dump-autoload。并重新检查您的观点。
  • @majimboo。没有任何变化。我有错误。我的应用程序在更新之前没有任何问题。
  • 这个视图在哪里调用? [admin.profile.index]
  • @majimboo。从菜单。 <a href="{{ URL::route('admin.profile.index') }}">profile Managment</a>

标签: php laravel laravel-4


【解决方案1】:

当然 - 使用 composer update,您正在更新包并由于更新的更改而破坏了一些代码。 Composer 更新正在从 composer.json 文件中读取。您应该运行 composer install,它正在读取 composer.lock 文件。 Composer.lock 将您的依赖项“锁定”到已知状态,因此您的应用程序不会崩溃。

【讨论】:

  • 在 Way 文件中。他说安装方式/生成器必须是更新作曲家。如何安装way/generators
  • Way generators 安装过程:首先使用 composer 拉取那个包 require way/generators 然后在 app/config/app 下添加一个新的服务提供者 - 服务提供者数组最后在同一个文件中添加新的别名(可选)如果您不想输入长包名。比更新。因为我很遗憾在全球范围内更新将更新所有软件包 - 所以请注意这一点。
猜你喜欢
  • 1970-01-01
  • 2021-04-02
  • 2019-10-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-06-10
  • 2014-10-27
  • 2014-04-21
相关资源
最近更新 更多