-1

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);
    }

Zoran Relić
  • 45
  • 1
  • 12

1 Answers1

1

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()
    {
        //
    }

}

ege
  • 774
  • 5
  • 19
  • @ZoranRelić when you have found an answer to your question you should mark it as 'accepted'. https://stackoverflow.com/help/someone-answers – ege Nov 27 '19 at 11:32