[英]error when i run php artisan migrate command on line 51
When I run the php artisan migrate command in terminal I'm left with this.当我在终端中运行 php artisan migrate 命令时,我只剩下这个了。
ParseError
syntax error, unexpected ')'
at C:\laragon\www\testnum2\vendor\laravel\framework\src\Illuminate\Bus\BusServiceProvider.php:51
47▕ return new DatabaseBatchRepository(
48▕ $app->make(BatchFactory::class),
49▕ $app->make('db')->connection(config('queue.batching.database')),
50▕ config('queue.batching.table', 'job_batches'),
➜ 51▕ );
52▕ });
53▕ }
54▕
55▕ /**
1 C:\laragon\www\testnum2\vendor\composer\ClassLoader.php:322
Composer\Autoload\includeFile("C:\laragon\www\testnum2\vendor\composer/../laravel/framework/src/Illuminate/Bus/BusServiceProvider.php")
2 [internal]:0
Composer\Autoload\ClassLoader::loadClass("Illuminate\Bus\BusServiceProvider")
PS C:\laragon\www\testnum2>
I'm not quite sure what is causing but this is the code for that file thats causing the error.我不太确定是什么原因造成的,但这是导致错误的那个文件的代码。
<?php
namespace Illuminate\Bus;
use Illuminate\Contracts\Bus\Dispatcher as DispatcherContract;
use Illuminate\Contracts\Bus\QueueingDispatcher as QueueingDispatcherContract;
use Illuminate\Contracts\Queue\Factory as QueueFactoryContract;
use Illuminate\Contracts\Support\DeferrableProvider;
use Illuminate\Support\ServiceProvider;
class BusServiceProvider extends ServiceProvider implements DeferrableProvider
{
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->singleton(Dispatcher::class, function ($app) {
return new Dispatcher($app, function ($connection = null) use ($app) {
return $app[QueueFactoryContract::class]->connection($connection);
});
});
$this->registerBatchServices();
$this->app->alias(
Dispatcher::class, DispatcherContract::class
);
$this->app->alias(
Dispatcher::class, QueueingDispatcherContract::class
);
}
/**
* Register the batch handling services.
*
* @return void
*/
protected function registerBatchServices()
{
$this->app->singleton(BatchRepository::class, DatabaseBatchRepository::class);
$this->app->singleton(DatabaseBatchRepository::class, function ($app) {
return new DatabaseBatchRepository(
$app->make(BatchFactory::class),
$app->make('db')->connection(config('queue.batching.database')),
config('queue.batching.table', 'job_batches'),
);
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return [
Dispatcher::class,
DispatcherContract::class,
QueueingDispatcherContract::class,
BatchRepository::class,
];
}
}
I hope that this is enough to get help.我希望这足以获得帮助。 I wanna also mention that I've used php artisan migrate before and recently I had to upgrade some things like composer and phpmyadmin
我还想提一下,我之前使用过 php artisan migrate,最近我不得不升级一些东西,比如 composer 和 phpmyadmin
The problem is that the PHP version you're using ( below 7.3 ) does not support trailing comma in function calls.问题是您使用的 PHP 版本(低于 7.3 )不支持函数调用中的尾随逗号。
Please read this: Trailing Commas are allowed in Calls请阅读: Calls 中允许使用尾随逗号
Solution is to switch to > PHP 7.3
解决办法是切换到
> PHP 7.3
Well my problem was my PHP being <7.3好吧,我的问题是我的 PHP <7.3
But when I simply checked it in phpinfo file it showed up as 7.4.11.但是当我简单地在 phpinfo 文件中检查它时,它显示为 7.4.11。
@lagbox helped me by saying : "there are different versions on your system, and the CLI and the webserver can have different configurations" @lagbox 帮助我说: “您的系统上有不同的版本,CLI 和网络服务器可以有不同的配置”
To be honest I wasn't sure exactly what to do from that but I decided to just delete PHP 7.2 from my PATH .老实说,我不确定该怎么做,但我决定从我的 PATH 中删除 PHP 7.2 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.