当我在线上传我的应用程序时遇到错误,尽管该错误并未出现在我的本地主机上
以下是我的appserviceprovider.php的样子
在你说它改变之前
use Illuminate\Support\Facades\Schema;
要
use Schema;
我仍有同样的问题
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
use DB;
use View;
use Request;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//Check for database connection
try {
DB::connection()->getPdo();
} catch (\Exception $e) {
if (Request::is('database/setup')) {
echo View::make('common/database/setup', array('error' => $e->getMessage()));
die();
}
else {
echo View::make('errors/database', array('error' => $e->getMessage()));
die();
}
}
Schema::defaultStringLength(191);
/*if (Schema::hasTable('categories')) {
$categories = DB::table('categories')->get();
view()->composer('frontend.layouts.include.header', function($view) use ($categories){
$view->with('categories',$categories);
});
}
if (Schema::hasTable('tags')) {
$tags = DB::table('tags')->get();
view()->composer('frontend.layouts.include.sidebar', function($view) use ($tags){
$view->with('tags',$tags);
});
}*/
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}
答案 0 :(得分:0)
我有同样的问题。所以我只包括
使用Illuminate \ Support \ Facades \ Schema;
AppServiceProvider类I的顶部,问题已解决。
使用Laravel 5.8