Completed
Push — master ( 7840cd...ebd957 )
by CodexShaper
11:45
created

PostAuthorScope   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A apply() 0 2 1
1
<?php
2
/**
3
 * The post author scope.
4
 *
5
 * @link       https://github.com/maab16
6
 * @since      1.0.0
7
 *
8
 * @package    WPB
9
 * @subpackage WPB/src/Database/Eloquent/Scopes
10
 */
11
12
namespace WPB\Database\Eloquent\Scopes;
13
14
use Illuminate\Database\Eloquent\Builder;
15
use Illuminate\Database\Eloquent\Model;
16
use Illuminate\Database\Eloquent\Scope;
17
18
/**
19
 * The Post Author Scope class.
20
 *
21
 * @since      1.0.0
22
 * @package    WPB
23
 * @subpackage WPB/src/Database/Eloquent/Scopes
24
 * @author     Md Abu Ahsan basir <[email protected]>
25
 */
26
class PostAuthorScope implements Scope {
27
28
	/**
29
	 * Apply the scope to a given Eloquent query builder.
30
	 *
31
	 * @param \Illuminate\Database\Eloquent\Builder $builder The eloquent builder.
32
	 * @param \Illuminate\Database\Eloquent\Model   $model The eloquent model.
33
	 *
34
	 * @return void
35
	 */
36
	public function apply( Builder $builder, Model $model ) {
37
		$builder->whereNull( 'post_author' );
38
	}
39
}
40