2016-06-09 93 views
1

我正在尝试在服务器上获取Laravel项目;一切工作正常本地,我发送所有文件到服务器,改变routes.php和.env,以便一切都可以工作(数据库,查询,路由...)。Laravel - 服务器上的请求错误

我工作在一个反向代理之后,但是让路由起作用并不是问题。

我可以登录,但我无法访问或执行任何使用数据库的内容(登录除外)。

实施例:

控制器:

public function show($id) { 
    $compte = Compte::find($id); 
    $suiviFormation = User_formation::join('formation', 'formation.id_formation', '=', 'user_formation.id_formation') 
              ->join('type_formation', 'formation.id_type_formation', '=', 'type_formation.id_type_formation') 
              ->where('id_compte', $id) 
              ->where(function($query){ 
               $query->where('formation.id_organisme', 1) 
                 ->orWhere('formation.id_organisme', Auth::user()->id_organisme); 
              }) 
              ->where('valide', 1) 
              ->orderBy('type_formation.nom', 'asc') 
              ->orderBy('formation.nom', 'asc') 
              ->orderBy('date_formation', 'desc') 
              ->get(); 
     $formations = array(); 
     $types = array(); 

     foreach($suiviFormation as $suivi){ 
      $formations[] = Formation::find($suivi->id_formation); 
     } 

     foreach($formations as $formation){ 
      $types[$formation->id_type_formation] = $formation->type_formation->nom; 
     } 


     $userPoste = User_Poste::where('id_compte', $id) 
      ->where('date_fin', null) 
      ->first(); 


     $formationsAvailable = Formation::select('formation.id_type_formation', 'formation.nom', 'formation_importance.importance') 
              ->join('formation_importance', 'formation_importance.id_formation', '=', 'formation.id_formation') 
              ->join('poste', 'poste.id_poste', '=', 'formation_importance.id_poste') 
              ->where('formation_importance.id_poste', $userPoste->id_poste) 
              ->where('importance', '!=', 1) 
              ->orderBy('formation.nom', 'asc') 
              ->groupBy('formation.id_formation') 
              ->get(); 

     return view('formation/formation_show', ['compte' => $compte, 'types' => $types, 'suiviFormation' => $suiviFormation, 
      'formations' => $formations, 'formationsAvailable' => $formationsAvailable]); 
    } 

错误:

QueryException in Connection.php line 624: SQLSTATE[42S02]: Base table or view not found: 
1146 Table 'greement.Formation' doesn't exist 
(SQL: select * from `Formation` where `Formation`.`id_formation` = 61 limit 1) 

每一个误差看起来像这一个。


了解到数据库连接的一部分正在工作,其他页面如何工作?

.ENV:

APP_ENV=local 
APP_DEBUG=true 
APP_KEY= appkey 
DB_HOST= database.host 
DB_DATABASE=greement 
DB_USERNAME=user 
DB_PASSWORD=******* 
CACHE_DRIVER=file 
SESSION_DRIVER=file 
QUEUE_DRIVER=sync 

编辑:我没有到服务器的直接访问,我只能用FTP & phpMyAdmin的数据库。

回答

1

您的服务器上没有数据库中的表格。您需要使用php artisan migrate命令运行迁移,该命令将为您创建表。或者,您可以从数据库转储文件恢复服务器上的数据库数据。

+1

我无法直接访问服务器,因此无法执行此操作。我会尝试恢复数据库(添加问题)。谢谢 –

+0

从.sql文件恢复数据库日期没有解决问题,我仍然有同样的错误。另外,我在DB中有表格,因为如果我没有登录网站,我就无法登录。 –

+0

你想告诉我你有'Formation'表,但仍然得到完全相同的错误?如果不是,请检查phpMyAdmin表名是否与Laravel试图使用的完全相同。 –

相关问题