Ad
Symfony\Component\Debug\Exception\FatalThrowableError : Syntax Error, Unexpected 'public' (T_PUBLIC)
Hi i had a problem PHP artisan migrate does not migrate all tables followed the procedure but i got another error.
λ 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 file was changed, I even tried to put the new class on the top. And the error is the same exept it is detected on a different row.
<?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);
}
Ad
Answer
Your app/Providers/AppServiceProvider.php
should look similar to this
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider {
public function boot(){
\Schema::defaultStringLength(191);
}
public function register()
{
//
}
}
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad