Francisunoxx Francisunoxx - 1 year ago 52
PHP Question

Why SoftDelete won't fake the deleted row?

Can somebody tell me why using

method won't delete the selected row in table?
works well but the row that has been soft delete is still exist in the table. I'm expecting my table row will be hide or deleted but it can't. Any tips or help would appreciated! :) I
my table like this.


public function hideApprovalsDocument(Request $request, Document $id)
//Getting the request in the View.
$id = $request->get('softDelete');
$hide = Document::findOrFail($id)->where('id', '=', $id);

return redirect()->back();


public function documentsSentForApproval()

$pendingDocuments = DB::table('approvals_document')
->select('documents.title', 'documents.content', ' as documentId',
'users.username', 'approvals_document.created_at',
'', 'approvals_document.approver_id', 'approvals_document.requestedBy')
->join('documents', '', '=', 'approvals_document.document_id')
->join('categories', '', '=', 'documents.category_id')
->join('users', '', '=', 'approvals_document.approver_id')
->where('approver_id', '=', Auth::id())
->where('documents.deleted_at', '=', null)
->orWhere('requestedBy', '=', Auth::id())
->orderBy('', '=', 'desc')

return view ('document.pending')
->with('pendingDocuments', $pendingDocuments);


Answer Source

Can you please change the join query to below

->join('documents', function ($join) `{ $join->on('', '=','approvals_document.document_id') 
->whereNull('documents.deleted_at'); })`
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download