Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 8 |
| Owner | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
12.00 | |
0.00% |
0 / 8 |
| filterAuthorities | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 5 |
|||
| getIncreasedCheckingCount | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| <?php | |
| namespace App; | |
| use Illuminate\Database\Eloquent\Model; | |
| use Illuminate\Support\Facades\Auth; | |
| /** | |
| * @method static orderBy(string $string, string $string1) | |
| */ | |
| class Owner extends Model | |
| { | |
| public $fillable = ['name','code','checking_count']; | |
| public static function filterAuthorities(){ | |
| $user=Auth::user(); | |
| if(!$user){ | |
| return (new static)->newQuery()->where('id','0'); | |
| } | |
| $ownerIds=$user->getPermittingOwnerIdsAttribute(); | |
| return (new static)->newQuery()->whereIn('id',$ownerIds); | |
| } | |
| public function getIncreasedCheckingCount(){ | |
| $this['checking_count']=$this['checking_count']+1; | |
| $this->update(); | |
| return $this['checking_count']; | |
| } | |
| } |