Support the ongoing development of Laravel.io →
Database Eloquent

Hi,

I am using SoftDelete in many models of my app by defining it like this:

class Entries extends Eloquent { protected $softDelete = true; protected $table = 't_entries'; }

In some cases, I am joining 2 tables using eloquent join - both of this tables are defined to use SoftDelete.

But if the related entry in the joined table is marked as deleted, the joint result will be shown.

So it seems, that the relation is not handled by elequent but by mySQL - and mySQL doesn't know about this SoftDelete mechanism.

Is there a simple way to prevent me from adding a lot of "deleted_at is NULL" to my queries?

Thanks

Dirk

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

diwaffm diwaffm Joined 10 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.