<th>Action</th> <!-- <th>Follow-Up Date</th> --> <th>Notes</th> <th>Reason</th> <th>Sales Invoices</th> <th>Status</th> </tr> </thead> <tbody> @foreach ($collection_logs as $cLog) <tr> <?php $date = Carbon\Carbon::parse($cLog->date)->toFormattedDateString(); $salesinvoices = App\SalesInvoiceCollectionLog::join('clients', 'sales_invoice_collection_logs.client_id', '=', 'clients.id')->join('sales_invoices', 'sales_invoice_collection_logs.sales_invoice_id', '=', 'sales_invoices.id')->join('collection_logs', 'sales_invoice_collection_logs.collection_log_id', '=', 'collection_logs.id')->where('sales_invoice_collection_logs.client_id', $cLog->client_id)->where('sales_invoice_collection_logs.collection_log_id', $cLog->id)->select('*')->get(); ?> <td>{{ $date }}</td> <td>{{ $cLog->action }}</td> <td>{{ $cLog->note }}</td> @if ($cLog->Reason == null) <td>---------</td> @else <td>{{ $cLog->Reason->reason }}</td> @endif <td> @foreach($salesinvoices as $salesinvoice) <a href="{{ action ('SalesInvoicesController@show', [$salesinvoice->SalesInvoice->id])}}">{{$salesinvoice->SalesInvoice->si_no}}</a> <br>