PostStatusScope::apply()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * The post status scope.
4
 *
5
 * @link       https://github.com/maab16
6
 * @since      1.0.0
7
 */
8
9
namespace CodexShaper\WP\Database\Eloquent\Scopes;
10
11
use Illuminate\Database\Eloquent\Builder;
12
use Illuminate\Database\Eloquent\Model;
13
use Illuminate\Database\Eloquent\Scope;
14
15
/**
16
 * The Post Status Scope class.
17
 *
18
 * @since      1.0.0
19
 *
20
 * @author     Md Abu Ahsan basir <[email protected]>
21
 */
22
class PostStatusScope implements Scope
23
{
24
    /**
25
     * Apply the scope to a given Eloquent query builder.
26
     *
27
     * @param \Illuminate\Database\Eloquent\Builder $builder $builder The eloquent builder.
28
     * @param \Illuminate\Database\Eloquent\Model   $model   $model The eloquent model.
29
     *
30
     * @return void
31
     */
32
    public function apply(Builder $builder, Model $model)
33
    {
34
        $builder->where('post_status', '=', 'publish');
35
    }
36
}
37