我需要你的帮助...我基本上已经用尽了 Google 提出的所有链接:D 没有任何东西可以帮助我查明问题...因此修复。
如果我使用命令:npm run dev,浏览器控制台中会出现以下错误(该页面仍然显示......只是需要更长的时间)
使用 npm run build 不会出现该错误。
我正在使用以下 .env 配置
APP_NAME=App
APP_ENV=local
APP_KEY=*censored*
APP_DEBUG=true
APP_URL=https://app.dev
Run Code Online (Sandbox Code Playgroud)
和 .vite.config.js
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';
export default defineConfig({
plugins: [
laravel({
input: 'resources/js/app.js',
refresh: true,
}),
vue({
template: {
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
},
}),
],
});
Run Code Online (Sandbox Code Playgroud)
Laragon 在以下环境下启动, 在此处输入图像描述
谢谢 !!闪电网络
我看到这可能是由于 SSL 造成的,我可能需要安装一个自助证书模块...但我没有看到明确的说明,所以现在我还没有尝试这个滑雪道
我正在使用 Laravel 9,我有一个像这样的控制器:
use App\Repositories\HomeRepositoryInterface;
class HomeController extends Controller
{
private $homeRespository;
public function __construct(HomeRepositoryInterface $homeRepository)
{
$this->homeRespository = $homeRepository;
}
...
Run Code Online (Sandbox Code Playgroud)
这是HomeRepositoryInterface:
<?php
namespace App\Repositories;
interface HomeRepositoryInterface
{
public function newest();
}
Run Code Online (Sandbox Code Playgroud)
这就是它HomeRepository本身:
<?php
namespace App\Repositories;
use App\Models\Question;
class HomeRepository implements HomeRepositoryInterface
{
public function newest()
{
return $ques = Question::orderBy('created_at', 'DESC')->paginate(10);
}
}
Run Code Online (Sandbox Code Playgroud)
但现在我得到这个错误:
构建 [App\Http\Controllers\HomeController] 时,目标 [App\Repositories\HomeRepositoryInterface] 不可实例化。
那么这里出了什么问题呢?
我该如何解决这个问题?
如何使用 laravel/pint 1.4 删除负 \xe2\x80\x9c!\xe2\x80\x9d 符号后面的空格?
\n不是 :
\nif (! self::$wasSetup) {\nRun Code Online (Sandbox Code Playgroud)\n但 :
\nif (!self::$wasSetup) {\nRun Code Online (Sandbox Code Playgroud)\n我想最后一个是 psr-12 规则......
\n谢谢!
\n我有一个项目,我有一个“习惯”表,该表需要一个播种器来为其提供数据,简单地说,它是一个带有原始数据的播种器,我需要烹饪它,换句话说,我需要处理就像这样...
\npublic function run()\n{\n $Habits = [\n \'Good\' => [\'A\', \'B\', \'C\', \'D\', \'E\', \'F\', \'G\', \'H\', \'I\', \'J\'],\n \'Neutral\' => [\'k\', \'l\', \'m\', \'n\', \'o\', \'p\', \'q\', \'r\', \'t\'],\n \'\xe2\x98\xb9\xef\xb8\x8fBad\' => [\'1\', \'2\', \'3\', \'4\', \'5\', \'6\', \'7\', \'8\', \'9\', \'10\'],\n ];\n \n foreach ($habits as $habit_category => $names) {\n foreach ($names as $name) {\n DB::table(\'habits\')->insert([\n \'name\' => $name,\n \'category\' => $habit_category\n ]);\n }\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n这是数据库播种器
\npublic function run()\n{\n $this->call([\n HabitsSeeder::class,\n ]);\n}\nRun Code Online (Sandbox Code Playgroud)\n我知道逻辑没有缺陷,但我不知道我是否做得正确,但无论如何,给出的错误在标题中:
\n\n …
我有一个 laravel 项目,刚刚从 8.x 升级到最新的 9.x。作为升级的一部分,它需要许多其他组件,例如文件系统(我猜称为 Flysystem)也从 1.x 升级到 3.x。我有一行代码现在导致我的系统崩溃:
if (Storage::disk($disk)->exists($avatarFilename)) {
Run Code Online (Sandbox Code Playgroud)
这以前一直有效,但现在又回来了:
ERROR: Unable to check existence for: avatars/31-feea15debc.png
[stacktrace]
#0 D:\\vhosts\\vendor\\league\\flysystem-aws-s3-v3\\AwsS3V3Adapter.php(157): League\\Flysystem\\UnableToCheckExistence::forLocation('avatars/31-feea...', Object(Aws\\S3\\Exception\\S3Exception))
#1 D:\\vhosts\\vendor\\league\\flysystem\\src\\Filesystem.php(48): League\\Flysystem\\AwsS3V3\\AwsS3V3Adapter->directoryExists('avatars/31-feea...')
#2 D:\\vhosts\\vendor\\laravel\\framework\\src\\Illuminate\\Filesystem\\FilesystemAdapter.php(174): League\\Flysystem\\Filesystem->has('avatars/31-feea...')
#3 D:\\vhosts\\app\\Models\\User.php(1120): Illuminate\\Filesystem\\FilesystemAdapter->exists('avatars/31-feea...')
#4 D:\\vhosts\\scoutek.com\\storage\\framework\\views\\eb5469bb9d755dff931d80dd79d9a76a9a7a2a21.php(10): App\\Models\\User->getAvatar()
Run Code Online (Sandbox Code Playgroud)
在深入研究 Laravel 日志文件中报告的数千行后,我发现以下内容看起来是异常的原因:
(Aws\\S3\\Exception\\S3Exception(code: 0): Error executing
\"ListObjects\" on
\"https://scoutek-development.s3.amazonaws.com/?prefix=avatars%2F31-feea15debc.png%2F&max-keys=1&delimiter=%2F&encoding-type=url\";
AWS HTTP error: cURL error 60: SSL certificate problem:
unable to get local issuer certificate
(see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for
Run Code Online (Sandbox Code Playgroud)
我已经使用 OpenSSL 并创建了我的密钥和证书文件,并在 apache conf 文件中引用了它们,当我运行 phpinfo() 时,我可以看到我在创建证书时输入的所有本地主机证书数据,因此 php 似乎知道该证书。我正在运行 WAMP 3.2.3、PHP 8.1.5、Apache 2.4.46
我安装了一个空白的 Laravel 9。唯一添加的扩展是 jetstream 和 livewire。我正在尝试安装 spatie/laravel-comments 包,但出现以下错误。
您的要求无法解析为一组可安装的软件包。
问题1 - 根composer.json需要spatie/laravel-comments ^0.0.2 -> 可满足spatie/laravel-comments[0.0.2]。- spatie/laravel-comments 0.0.2 需要照明/合同 ^8.73 -> 找到照明/合同[v8.73.0, ..., 8.x-dev] 但这些没有加载,可能是因为它与另一个需求冲突。
您还可以尝试使用显式版本约束重新运行composer require,例如“composer require spatie/laravel-comments:*”来确定是否有任何版本可安装,或者“composer require spatie/laravel-comments:^2.1”如果你知道你需要哪个。
安装失败,将 ./composer.json 和 ./composer.lock 恢复为其原始内容。
如果我指定要安装的版本或将其保留为最新版本,则会出现相同的错误。我尝试删除composer.lock文件并重新安装所有内容,我的composer.json看起来像。
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.0.2",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^9.11",
"laravel/jetstream": "^2.8",
"laravel/sanctum": "^2.14.1",
"laravel/tinker": "^2.7",
"livewire/livewire": "^2.10"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": …Run Code Online (Sandbox Code Playgroud) 在此处输入图像描述当我在 laravel 中创建新项目并且我想构建身份验证时遇到问题...这是我的 cmd 命令:
laravel new laravel2030
cd laravel2030
composer require laravel/ui
php artisan ui bootstrap --auth
npm install
npm run dev
Run Code Online (Sandbox Code Playgroud)

我正在尝试将公共文件夹更改为 Cpanel 上的 public_html 文件夹,并且它在我的计算机上的本地模式下工作正常。
我尝试了这些步骤。
./app/AppServiceProvider.php 添加此代码
public function register(){ $this->app->bind('path.public', function() {
return base_path().'/public_html'; });}
Run Code Online (Sandbox Code Playgroud)
./config/filesystems.php 将 public 更改为 public_html
'public' => ['driver' => 'local','root' =>
storage_path('app/public'),'url' =>
env('APP_URL').'/storage','visibility' => 'public',],
Run Code Online (Sandbox Code Playgroud)
./webpack.mix.js 将 public 更改为 public_html
mix.config.publicPath='public_html';
mix.js('resources/assets/js/app.js', 'public_html/js')
.sass('resources/assets/sass/app.scss', 'public_html/css');
Run Code Online (Sandbox Code Playgroud)
index.php 添加此代码
$app->bind('path.public', function() { return __DIR__; });
Run Code Online (Sandbox Code Playgroud)
./bootstrap/app.php 添加此代码
$app->bind('path.public', function() { return base_path().'/public_html'; });
Run Code Online (Sandbox Code Playgroud)
运行后 -> npm run dev
它会自动创建一个 public 文件夹并创建一个 public_html 文件夹,其中包含 mix-manifest.json 文件,并且网站上出现此错误。

内部服务器错误 服务器遇到内部错误或配置错误,无法完成您的请求。
请通过 webmaster@example.com 联系服务器管理员,告知他们此错误发生的时间以及您在出现此错误之前执行的操作。
有关此错误的更多信息可在服务器错误日志中找到。
此外,尝试使用 ErrorDocument 处理请求时遇到 …
所以..我用Laravel 9开发了一个项目,然后我不得不通过 FTP 将其上传到我的客户端服务器(这很慢而且痛苦),后来才发现我的客户端服务器 PHP 版本不能超过 8.0。我尝试打开项目实时链接(到我上传的位置),composer 平台检查告诉我我的项目依赖于 PHP 8.1,而我的版本是 8.0。
因此,我尝试调整平台检查 php 文件以禁用此检查,看看它是否能正常工作,但不行,该项目抛出了错误。
所以我决定降级到 laravel 8,因为经过搜索后我发现 laravel 8 不需要 php 8.1 。我想我读到了一些错误的信息,因为在调整我的项目降级到 laravel 8 并再次上传(通过 ftp 痛苦地)之后,平台检查再次告诉我我的项目需要 PHP 8.1。
因此,我通过编辑/调整平台检查 php 文件再次禁用了此平台检查,看看它是否能正常工作,而且它确实有效。所以一切都好。但今天我正在学习如何检查哪些 Composer 包依赖于特定的 php 版本,在这个过程中我发现(如果我没记错的话)laravel 8 具有依赖于 PHP 8.1 的包依赖项?
是否有一个表格可以检查哪些 Laravel 版本依赖于哪些 PHP 版本,或者我是否必须在每个项目上运行一些命令来检查这些依赖关系?
就像下面的图片一样:
谢谢 !
我有一个关于如何根据我传递的参数使观察者的方法静音的问题。我有一个参数link_social,如果它设置为 false,我希望观察者不触发该created()函数。
$role = $request->role == 'creator' ? 'creator' : 'sponsor';
if($request->link_social == true){
$user = Auth::user()->$role()->create([
'name' => $request->safe()->name,
'about' => $request->safe()->about,
'account_plan_id' => $accountPlan->id,
]);
} else{
$user = Auth::user()->$role()->create([
'name' => $request->safe()->name,
'about' => $request->safe()->about,
'account_plan_id' => $accountPlan->id,
])->saveQuietly();
}
Run Code Online (Sandbox Code Playgroud)
该User模型有一个关系方法creator,观察者来自该模型,名为CreatorObserver
但我得到了这个
"message": "Call to undefined method App\\Models\\Creator::saveQuitely()"
保存(编辑)时出错,但仍然会触发created()创建者观察者中的事件,该观察者正在将记录保存在另一个表中。
我正在尝试做类似的事情$user->role->create()->saveQuitely()
创造者观察者
class CreatorObserver
{
/**
* Handle the Creator "created" event.
*
* @param \App\Models\Creator …Run Code Online (Sandbox Code Playgroud)