Passed
Push — main ( ec0923...4d334c )
by Seth
01:22
created

File::newFactory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace SaasReady\Models;
4
5
use Carbon\Carbon;
0 ignored issues
show
Bug introduced by
The type Carbon\Carbon was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Illuminate\Database\Eloquent\Factories\HasFactory;
0 ignored issues
show
Bug introduced by
The type Illuminate\Database\Eloquent\Factories\HasFactory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Illuminate\Database\Eloquent\Model;
0 ignored issues
show
Bug introduced by
The type Illuminate\Database\Eloquent\Model was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Illuminate\Database\Eloquent\Relations\MorphTo;
0 ignored issues
show
Bug introduced by
The type Illuminate\Database\Eloquent\Relations\MorphTo was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Illuminate\Database\Eloquent\SoftDeletes;
0 ignored issues
show
Bug introduced by
The type Illuminate\Database\Eloquent\SoftDeletes was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use SaasReady\Database\Factories\FileFactory;
11
use SaasReady\Traits\EloquentBuilderMixin;
12
use SaasReady\Traits\HasUuid;
0 ignored issues
show
Bug introduced by
The type SaasReady\Traits\HasUuid was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
14
/**
15
 * @property-read int $id
16
 * @property-read string $uuid
17
 * @property ?string $model_type
18
 * @property ?int $model_id
19
 * @property ?string $category
20
 * @property string $filename
21
 * @property string $original_filename
22
 * @property string $path
23
 * @property string $mime_type
24
 * @property int $size
25
 * @property string $source
26
 * @property ?Carbon $created_at
27
 * @property ?Carbon $updated_at
28
 * @property ?Carbon $deleted_at
29
 *
30
 * @property-read Model $model
31
 *
32
 * @mixin EloquentBuilderMixin
33
 */
34
class File extends Model
35
{
36
    use HasFactory;
37
    use SoftDeletes;
38
    use HasUuid;
39
40
    protected $table = 'files';
41
42
    protected $fillable = [
43
        'model_id',
44
        'model_type',
45
        'category',
46
        'filename',
47
        'original_filename',
48
        'size',
49
        'path',
50
        'mime_type',
51
        'source',
52
    ];
53
54
    protected $casts = [
55
        'size' => 'int',
56
        'model_id' => 'int',
57
    ];
58
59
    public function model(): MorphTo
60
    {
61
        return $this->morphTo('model');
62
    }
63
64
    /**
65
     * @codeCoverageIgnore
66
     */
67
    protected static function newFactory(): FileFactory
68
    {
69
        return FileFactory::new();
70
    }
71
}
72