Class 'Illuminate\Support\facades\Schema' not found

后端 未结 7 1818
终归单人心
终归单人心 2021-01-29 05:25

I am working with Laravel5.4. When I use socialite package to login with Facebook, I need to add this line of

Schema::defaultStringLength(191);
<
相关标签:
7条回答
  • 2021-01-29 05:41

    You must set the .env file This setting

    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=ilk
    DB_USERNAME=root
    DB_PASSWORD=
    

    in app/Providers/AppServiceProvider.php

    n

    amespace App\Providers;
    
    use Illuminate\Support\ServiceProvider;
    //hata almamak ıcın
    use Illuminate\Support\Facades\Schema;
    
    
    class AppServiceProvider extends ServiceProvider
    {
        /**
         * Bootstrap any application services.
         *
         * @return void
         */
        public function boot()
        {
          Schema::defaultStringLength(191);
         }
    
        /**
         * Register any application services.
         *
         * @return void
         */
        public function register()
        {
            //
        }
    }
    
    0 讨论(0)
  • 2021-01-29 05:42

    In my case, I use capital letter its work.

    use Illuminate\Support\facades\Schema;

    replace with this

    use Illuminate\Support\Facades\Schema;
    0 讨论(0)
  • 2021-01-29 05:44

    OMG I follow the marked answer of question below and replace the using statement with

    use Schema;
    

    and the error gone. But I still don't know why it works well on local and only cause error on server.

    Method 'create' not found in class Illuminate\Support\Facades\Schema

    0 讨论(0)
  • 2021-01-29 05:45

    Replace this line:

    use Illuminate\Support\facades\Schema;
    

    With this:

    use Schema;
    
    0 讨论(0)
  • 2021-01-29 05:46

    Maybe you need to change use Illuminate\Support\facades\Schema;

    to

    use Illuminate\Support\Facades\Schema;

    Facades needs to capital F

    0 讨论(0)
  • 2021-01-29 05:48

    Fix Capitalize Error and replace:

    use Illuminate\Support\facades\Schema;
    

    with

    use Illuminate\Support\Facades\Schema;
    

    The reason it might work on local and not work on server is that probably you're using windows locally, and Linux hosting account which is case-sensitive regarding the paths and filenames

    0 讨论(0)
提交回复
热议问题