| Code Coverage
| Classes and Traits | Functions and Methods | Lines
Total | 0.00% covered (danger) | 0.00% | 0 / 1 | 0.00% covered (danger) | 0.00% | 0 / 2 | CRAP | 0.00% covered (danger) | 0.00% | 0 / 8
Owner | 0.00% covered (danger) | 0.00% | 0 / 1 | 0.00% covered (danger) | 0.00% | 0 / 2 | 12.00 | 0.00% covered (danger) | 0.00% | 0 / 8
filterAuthorities | 0.00% covered (danger) | 0.00% | 0 / 1 | 6.00 | 0.00% covered (danger) | 0.00% | 0 / 5
getIncreasedCheckingCount | 0.00% covered (danger) | 0.00% | 0 / 1 | 2.00 | 0.00% covered (danger) | 0.00% | 0 / 3

1 | <?php
2 |
3 | namespace App;
4 |
5 | use Illuminate\Database\Eloquent\Model;
6 | use Illuminate\Support\Facades\Auth;
7 |
8 | /**
9 | * @method static orderBy(string $string, string $string1)
10 | */
11 | class Owner extends Model
12 | {
13 | public $fillable = ['name','code','checking_count'];
14 | public static function filterAuthorities(){
15 | $user=Auth::user();
16 | if(!$user){
17 | return (new static)->newQuery()->where('id','0');
18 | }
19 | $ownerIds=$user->getPermittingOwnerIdsAttribute();
20 | return (new static)->newQuery()->whereIn('id',$ownerIds);
21 | }
22 | public function getIncreasedCheckingCount(){
23 | $this['checking_count']=$this['checking_count']+1;
24 | $this->update();
25 | return $this['checking_count'];
26 | }
27 | }