Skip to content

Commit 285d049

Browse files
committed
Working on comments.
1 parent 446eec3 commit 285d049

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

eloquent.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,13 +399,25 @@ If an Eloquent model uses a trait that has a method matching the `bootNameOfTrai
399399

400400
The `apply` method receives an `Illuminate\Database\Eloquent\Builder` query builder object, and is responsible for adding any additional `where` clauses that the scope wishes to add. The `remove` method also receives a `Builder` object and is responsible for reversing the action taken by `apply`. In other words, `remove` should remove the `where` clause (or any other clause) that was added. So, for our `SoftDeletingScope`, the methods look something like this:
401401

402+
/**
403+
* Apply the scope to a given Eloquent query builder.
404+
*
405+
* @param \Illuminate\Database\Eloquent\Builder $builder
406+
* @return void
407+
*/
402408
public function apply(Builder $builder)
403409
{
404410
$model = $builder->getModel();
405411

406412
$builder->whereNull($model->getQualifiedDeletedAtColumn());
407413
}
408414

415+
/**
416+
* Remove the scope from the given Eloquent query builder.
417+
*
418+
* @param \Illuminate\Database\Eloquent\Builder $builder
419+
* @return void
420+
*/
409421
public function remove(Builder $builder)
410422
{
411423
$column = $builder->getModel()->getQualifiedDeletedAtColumn();

0 commit comments

Comments
 (0)