Skip to content

tkachikov/laravel-withtrashed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Laravel WithTrashed

License: MIT

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages