2016-12-09 70 views
0

我在本地開發了一個使用Laravel 5.2的網站。所有功能都完美運行。但是當我將它上傳到godaddy服務器時,除了雄辯之外,所有功能都在運行。插入,更新,刪除所有作品。但在數據庫引擎中顯示MYISAM。我在INNODB中更改它。但仍然雄辯不起作用。這是外鍵約束的問題嗎?錯誤是雄辯的變量沒有獲取數據。如何解決它?Laravel 5.2雄辯不能在godaddy服務器上工作

錯誤:

<body> 
    <div id="sf-resetcontent" class="sf-reset"> 
     <h1>Whoops, looks like something went wrong.</h1> 
     <h2 class="block_exception clear_fix"> 
      <span class="exception_counter">1/1</span> 
      <span class="exception_title"><abbr title="Symfony\Component\Debug\Exception\FatalErrorException">FatalErrorException</abbr> in <a title="/home/abhaymilestogo/public_html/floorstyler/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php line 797" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">Model.php line 797</a>:</span> 
      <span class="exception_message">Class &#039;\App\Model\organization&#039; not found</span> 
     </h2> 
     <div class="block"> 
      <ol class="traces list_exception"> 
       <li> in <a title="/home/abhaymilestogo/public_html/floorstyler/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php line 797" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">Model.php line 797</a></li> 
      </ol> 
     </div> 
    </div> 
</body> 

agency.blade.php

<tr> 
    <th>{{$agency['id']}}</th> 
    <th>{{$agency['name']}}</th> 
    <th>{{$agency->organization->name}}</th> 
    <th>{{$agency['status']}}</th> 
    <th>{{$agency['updated_at']}}</th> 
    <th>{{$agency['created_at']}}</th> 
    <th> 
     <a style="font-size: medium;" class="fa fa-pencil-square-o" href="agency/edit/{{$agency['name']}}/{{Crypt::encrypt($agency['id'])}}"></a> 

     <a style="font-size: medium;" class="fa fa-trash-o" id="{{Crypt::encrypt($agency['id'])}}"></a> 
     @if($agency['status'] == 'ALIVE') 
      <a style="font-size: medium;" class="fa fa-times" id="{{Crypt::encrypt($agency['id'])}}"></a> 
     @else 
      <a style="font-size: medium;" class="fa fa-check" id="{{Crypt::encrypt($agency['id'])}}"></a> 
     @endif 

    </th> 
</tr> 
@endforeach 

問題是在{{$ agency->組織 - >名}}

+0

是否有錯誤顯示?你檢查錯誤日誌嗎?你是否正確設置了數據庫? – aceraven777

+0

是的。我認爲數據庫設置是正確的。但不確定外鍵是否與使用MYISAM引擎初始化的表一樣。稍後我將它更改爲INNODB。 錯誤: ErrorException在eeb31122066c28d05a0d3e03d88967b5c2d171dd.php線51:試圖讓非對象的屬性(查看:/home/abhaymilestogo/public_html/floorstyler/resources/views/agency.blade.php) 該錯誤只發生了一個變量其中包含雄辯的功能。如果我刪除它,那麼錯誤不會顯示。 –

+0

在你的問題中顯示你的「代理」和「組織」模型。 –

回答

1

錯誤中明確指出,沒有找到Class \ App \ Model \ organization。

請檢查您是否在模型類「組織」中定義了命名空間,並驗證您指定的路徑是否正確。

此外,總是用大寫的第一個字母命名類是一個好習慣。

如果這不能解決錯誤,請將文件agency.blade.php發佈。

+0

是的,這是絕對正確的,它在我的本地機器上工作。我正在上傳agency.blade.php代碼。問題在哪裏。 –