Why soft deleted entities appear in query results?

Sometimes, you will get the soft deleted table entries with get() even with eloquent and protected $softDelete = true;. So to avoid this problem, use …->whereNull(‘deleted_at’)->get(); For example, this query will fetch all rows including soft deleted. DB::table(‘pages’)->select(‘id’,’title’, ‘slug’) ->where(‘is_navigation’,’=’,’yes’) ->where(‘parent_id’,’=’,$parent_id) ->orderBy(‘page_order’) ->get(); So the proper method is, DB::table(‘pages’)->select(‘id’,’title’, ‘slug’) ->where(‘is_navigation’,’=’,’yes’) ->where(‘parent_id’,’=’,$parent_id) ->whereNull(‘deleted_at’) ->orderBy(‘page_order’) ->get();

Cascading Soft Delete

I’ve come up with a solution to cascading soft-deletes recently using Postgres 9.6 that makes use of inheritance to partition entries into deleted and non-deleted ones. Here’s a copy of the document that I’m writing for our project: Cascading soft-deletes Abstract In this document I describe our current approach to deal with deletion of objects … Read more

Physical vs. logical (hard vs. soft) delete of database record? [closed]

Advantages are that you keep the history (good for auditing) and you don’t have to worry about cascading a delete through various other tables in the database that reference the row you are deleting. Disadvantage is that you have to code any reporting/display methods to take the flag into account. As far as if it … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)