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

PostAuthorScope::apply()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
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