tkachikov / laravel-withtrashed
Trait for set magic method withTrashed for models with SoftDelete
Installs: 1 135
Dependents: 2
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
This package is auto-updated.
Last update: 2025-04-07 18:36:05 UTC
README
Trait for set magic method withTrashed for models with SoftDelete
Usage
use Tkachikov\LaravelWithtrashed\WithTrsashed; class User { use WithTrashed; public function posts() { return $this->hasMany(Post::class); } } $posts = $user->posts; // default $postsWithTrashed = $user->postsWithTrashed; // using trait $postsBuilder = $user->posts(); //default $postsBuilderWithTrashed = $user->postsWithTrashed(); // using trait $userPosts = User::with('posts')->first(); // default $userPostsWithTrashed = User::with('postsWithTrashed')->first(); // using trait
License
This package is open-sourced software licensed under the MIT license.