我的合作者表中我Laravel應用中看到這下面 如何在Laravel顯示我的表中的數據5.2
我需要在我index.blade.php文件collaborator_id打印誰與驗證equel ::用戶() - > id與系統一起記錄。我在合作模式
public function scopeColabo($query){
return $query->where('collaborator_id',Auth::user()->id);}
寫了下面的代碼,這是我的ProjectCollaboratorController功能
public function index(){
$collaborators = Collaboration::colabo()->getreturn view('collaborators.index')->withCollaboration($collaborators);}
,這是我的index.blade.php
<div class="container">
@if($collaboration)
<div class="row">
@foreach ($collaboration as $proj)
<div class="col-md-3" style="border:1px solid #ccc;margin-left:5px;">
<h2><a href="/projects/{{ $proj->id }}">{!! $proj->project_id !!}</a></h2>
<p>Tasks: 0</p>
<p>Comments: 0</p>
<p>Attachments: 0</p>
</div>
@endforeach
</div>
@endif
@if($collaboration->isEmpty())
<h3>There are currently no Collaboration</h3>
@endif
</div>
但是當我點擊鏈接合作index.blade.php文件生成
There are currently no Projects
但在我的表中有數據....如何在協作中打印collaborator_id表與當前登錄的用戶進行關聯?
請避免張貼大截圖,幾乎沒有任何信息。 – tadman
'Auth :: user() - > id'的當前值是什麼? – Hackerman
已記錄的用戶ID是用戶的當前值 – Fernando