Laravel 5.6工匠防止加载资产

时间:2018-07-08 18:33:23

标签: php laravel artisan

我正在使用WSL(Windows子系统)。

我已将Laravel文件从Wamp移至WSL代客。之后,每个页面都将在没有公共文件资产的情况下加载到浏览器中。我已经检查了文件许可,可以。代客在Nginx上运行。因此,我认为没有htaccess问题。

有趣的是,如果我删除或重命名工匠文件,则在浏览器中一切正常。

但是,当artisan文件可用时,php artisan在命令行中运行正常。

我遇到了一个问题,当我运行作曲家更新时出现错误

  

警告:类解析不明确,“ App \ Models \ AdminSettings”为   在“ $ baseDir。'/app/Models/AdminSettings.php”和“   “ /mnt/c/Users/Themexplorer/sites/crowd/app/models/AdminSettings.php”,   将使用第一个。

实际上,两者都表示同一个文件。

我通过从composer json中删除这一行“ app / models”来解决了这个问题。

"classmap": [
        "database/seeds",
        "database/factories"
    ], 

Herer是我完整的作曲家json文件。

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": "^7.1.3",
        "fideloper/proxy": "^4.0",
        "intervention/image": "^2.4",
        "laravel/cashier": "~7.0",
        "laravel/framework": "5.6.*",
        "laravel/tinker": "^1.0",
        "laravelcollective/html": "5.6.*",
        "maatwebsite/excel": "^2.00",
        "yajra/laravel-datatables": "1.0"
    },
    "require-dev": {
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^2.0",
        "phpunit/phpunit": "^7.0",
        "fahim/laravel5-paypal-ipn": "dev-master@dev"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"

        ],
        "psr-4": {
            "App\\": "app/"
        },
        "files": [
            "app/helper.php",
            "app/global-functions.php"
           ]
    },
    "autoload-dev": {
        "psr-0": {
            "Tests\\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": [
            ]
        }
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate"
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true,

}

这是我的工匠文件代码

#!/usr/bin/env php
<?php

define('LARAVEL_START', microtime(true));

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/

require __DIR__.'/vendor/autoload.php';

$app = require_once __DIR__.'/bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/

$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);

$status = $kernel->handle(
    $input = new Symfony\Component\Console\Input\ArgvInput,
    new Symfony\Component\Console\Output\ConsoleOutput
);

/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/

$kernel->terminate($input, $status);

exit($status);

请帮助我解决问题。

0 个答案:

没有答案