PostStatusScope   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 13
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A apply() 0 3 1
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