Package Data | |
---|---|
Maintainer Username: | zobov |
Maintainer Contact: | ddzobov@gmail.com (Daniil Zobov) |
Package Create Date: | 2020-01-16 |
Package Last Update: | 2024-07-15 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-23 03:23:00 |
Package Statistics | |
---|---|
Total Downloads: | 274,347 |
Monthly Downloads: | 8,563 |
Daily Downloads: | 321 |
Total Stars: | 61 |
Total Watchers: | 4 |
Total Forks: | 18 |
Total Open Issues: | 7 |
Require this package with composer:
composer require ddzobov/laravel-pivot-softdeletes
use DDZobov\PivotSoftDeletes\Model;
class Post extends Model
{
public function tags()
{
return $this->belongsToMany(Tag::class)->withSoftDeletes();
}
}
class Tag extends Model
{
public function posts()
{
return $this->belongsToMany(Post::class)->withSoftDeletes();
}
}
use Illuminate\Database\Eloquent\Model;
use DDZobov\PivotSoftDeletes\Concerns\HasRelationships;
class Post extends Model
{
use HasRelationships;
public function tags()
{
return $this->belongsToMany(Tag::class)->withSoftDeletes();
}
}
class Tag extends Model
{
use HasRelationships;
public function posts()
{
return $this->belongsToMany(Post::class)->withSoftDeletes();
}
}
use DDZobov\PivotSoftDeletes\Model;
use DDZobov\PivotSoftDeletes\Relations\Pivot;
class Post extends Model
{
public function tags()
{
return $this->belongsToMany(Tag::class)->using(PostTag::class)->withSoftDeletes();
}
}
class Tag extends Model
{
public function posts()
{
return $this->belongsToMany(Post::class)->using(PostTag::class)->withSoftDeletes();
}
}
class PostTag extends Pivot
{
}
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Database\Eloquent\SoftDeletes;
use DDZobov\PivotSoftDeletes\Concerns\HasRelationships;
class Post extends Model
{
use HasRelationships;
public function tags()
{
return $this->belongsToMany(Tag::class)->using(PostTag::class)->withSoftDeletes();
}
}
class Tag extends Model
{
use HasRelationships;
public function posts()
{
return $this->belongsToMany(Post::class)->using(PostTag::class)->withSoftDeletes();
}
}
class PostTag extends Pivot
{
use SoftDeletes;
}
$this->belongsToMany(Post::class)->withSoftDeletes('custom_deleted_at');
composer test
The MIT License (MIT). Please see License File for more information.