• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

visavi / rotor / 27388066632

12 Jun 2026 01:15AM UTC coverage: 14.172%. Remained the same
27388066632

push

github

visavi
Исправил ошибки phpstan

0 of 36 new or added lines in 9 files covered. (0.0%)

4 existing lines in 3 files now uncovered.

816 of 5758 relevant lines covered (14.17%)

1.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/Models/Reader.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace App\Models;
6

7
use Illuminate\Database\Eloquent\Model;
8
use Illuminate\Database\Eloquent\Relations\BelongsTo;
9

10
/**
11
 * Class Reader
12
 *
13
 * @property int    $id
14
 * @property string $relate_type
15
 * @property int    $relate_id
16
 * @property string $ip
17
 * @property int    $created_at
18
 */
19
class Reader extends Model
20
{
21
    /**
22
     * Indicates if the model should be timestamped.
23
     */
24
    public $timestamps = false;
25

26
    /**
27
     * The attributes that aren't mass assignable.
28
     */
29
    protected $guarded = [];
30

31
    /**
32
     * Get the attributes that should be cast.
33
     */
34
    protected function casts(): array
×
35
    {
36
        return [
×
37
            'user_id' => 'int',
×
38
        ];
×
39
    }
40

41
    /**
42
     * Возвращает связь пользователя
43
     */
44
    public function user(): BelongsTo
×
45
    {
46
        return $this->belongsTo(User::class, 'user_id')->withDefault();
×
47
    }
48

49
    /**
50
     * Counting stat
51
     *
52
     * @param Model&object{countingField: string} $model
53
     */
54
    public static function countingStat(Model $model): void
×
55
    {
56
        $reader = self::query()
×
57
            ->where('relate_type', $model->getMorphClass())
×
NEW
58
            ->where('relate_id', $model->getKey())
×
59
            ->where('ip', getIp())
×
60
            ->first();
×
61

62
        if (! $reader) {
×
63
            self::query()->create([
×
64
                'relate_type' => $model->getMorphClass(),
×
NEW
65
                'relate_id'   => $model->getKey(),
×
66
                'ip'          => getIp(),
×
67
                'created_at'  => SITETIME,
×
68
            ]);
×
69

70
            $model->increment($model->countingField);
×
71
        }
72
    }
73
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc