Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Withtrashed

Laravel Withtrashed Laravel Package

tkachikov/laravel-withtrashed

A lightweight Laravel package that adds convenient withTrashed support to Eloquent queries and relationships, letting you include soft-deleted records without custom closures. Simplifies working with trashed models across your application.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Laravel Withtrashed
How do I install tkachikov/laravel-withtrashed in a Laravel app?
Install the package with Composer using composer require tkachikov/laravel-withtrashed. It follows Laravel conventions, so setup should feel familiar in existing applications. Check the README for any package-specific registration or usage notes before wiring it into your models.
What does tkachikov/laravel-withtrashed actually do?
The package adds convenient withTrashed() support to Laravel Eloquent relationships. It lets you include soft-deleted related records in relationship queries and eager loading without writing custom query closures. The goal is to keep relationship code clean and expressive.
Which Eloquent relationship types are supported?
The package works with common relationship types such as hasMany, hasOne, and belongsTo. You can use withTrashed() directly on supported relationships instead of building custom callbacks. Review the README for the exact supported usage in your relationship definitions.
Can I eager load soft-deleted related models with this package?
Yes, the package supports including soft-deleted models in eager-loaded relations. This helps when you need trashed related records available alongside active parent models. It avoids the need to repeat custom relationship closures throughout your application.
Do I need to change my database schema to use this package?
No, the package does not require database schema changes. It works with Laravel soft deletes that are already configured on your models. You can adopt it without adding columns or altering existing tables.
Does it work with Laravel soft deletes and the SoftDeletes trait?
Yes, the package is intended for Laravel models that use soft deletes. It lets relationships include related records that have been soft deleted. Make sure the related model is set up with Laravel's standard soft delete support.
How is this different from writing withTrashed() in a custom relationship closure?
A custom closure can include trashed records, but it often makes relationship definitions longer and more repetitive. This package provides convenient withTrashed() support directly on supported Eloquent relationships. That keeps common soft-delete use cases cleaner and easier to read.
What Laravel versions does tkachikov/laravel-withtrashed support?
Check the package composer.json and README for the exact Laravel version constraints. Because Laravel APIs evolve, you should confirm compatibility for your application version before upgrading. Testing in your own Laravel app is the safest way to verify support.
Can I use tkachikov/laravel-withtrashed in production?
The package is described as lightweight and requires no schema changes, which makes it easy to evaluate for production use. As with any Composer dependency, review its version constraints and test it in staging first. Confirm that its behavior matches your relationship and soft-delete requirements before deploying.
How do I test relationships that include trashed models?
Create related models that use Laravel soft deletes, soft delete some records, and then assert that the relationship or eager load includes those records. Use Laravel's testing tools and database setup that match your application. The package README and its own tests can provide examples of expected behavior.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package