【发布时间】:2020-03-22 21:05:16
【问题描述】:
您好,我遇到了问题PHP artisan migrate does not migrate all tables 遵循了该程序,但我遇到了另一个错误。
λ php artisan migrate
Symfony\Component\Debug\Exception\FatalThrowableError : syntax error, unexpected 'public' (T_PUBLIC), expecting end of file
at C:\laragon\www\blog\app\Providers\AppServiceProvider.php:34
30| }
31|
32| use Illuminate\Support\Facades\Schema;
33|
> 34| public function boot()
35| {
36| Schema::defaultStringLength(191);
37| }
38|
Exception trace:
1 Composer\Autoload\includeFile("C:\laragon\www\blog\vendor\composer/../../app/Providers/AppServiceProvider.php")
C:\laragon\www\blog\vendor\composer\ClassLoader.php:322
2 Composer\Autoload\ClassLoader::loadClass("App\Providers\AppServiceProvider")
[internal]:0
Please use the argument -v to see more details.
AppServiceProvider.php 文件已更改,我什至尝试将新类放在顶部。并且错误是相同的,除非它在不同的行上检测到。
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
}
use Illuminate\Support\Facades\Schema;
public function boot()
{
Schema::defaultStringLength(191);
}
【问题讨论】:
-
您是否将该代码粘贴到课堂之外?您可以粘贴整个
AppServiceProvider(在您的问题中)吗? -
发布迁移代码
-
好吧,然后将代码发布到您的
AppServiceProvider.php课程中。您可能应该将use声明进一步提高。 -
是的。我什至尝试重新启动 Laragon,所以我使用该架构代码运行 php artisan serve 但我得到了相同的错误消息,只是为了找出问题所在