1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SaasReady\Models; |
4
|
|
|
|
5
|
|
|
use Carbon\Carbon; |
|
|
|
|
6
|
|
|
use Illuminate\Contracts\Filesystem\Filesystem; |
|
|
|
|
7
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory; |
|
|
|
|
8
|
|
|
use Illuminate\Database\Eloquent\Model; |
|
|
|
|
9
|
|
|
use Illuminate\Database\Eloquent\Relations\MorphTo; |
|
|
|
|
10
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes; |
|
|
|
|
11
|
|
|
use Illuminate\Filesystem\FilesystemManager; |
|
|
|
|
12
|
|
|
use Illuminate\Support\Facades\Storage; |
|
|
|
|
13
|
|
|
use SaasReady\Database\Factories\FileFactory; |
14
|
|
|
use SaasReady\Traits\EloquentBuilderMixin; |
15
|
|
|
use SaasReady\Traits\HasUuid; |
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @property-read int $id |
19
|
|
|
* @property-read string $uuid |
20
|
|
|
* @property ?string $model_type |
21
|
|
|
* @property ?int $model_id |
22
|
|
|
* @property ?string $category |
23
|
|
|
* @property string $filename |
24
|
|
|
* @property string $original_filename |
25
|
|
|
* @property string $path |
26
|
|
|
* @property string $mime_type |
27
|
|
|
* @property int $size |
28
|
|
|
* @property string $source |
29
|
|
|
* @property ?Carbon $created_at |
30
|
|
|
* @property ?Carbon $updated_at |
31
|
|
|
* @property ?Carbon $deleted_at |
32
|
|
|
* |
33
|
|
|
* @property-read ?Model $model |
34
|
|
|
* |
35
|
|
|
* @mixin EloquentBuilderMixin |
36
|
|
|
*/ |
37
|
|
|
class File extends Model |
38
|
|
|
{ |
39
|
|
|
use HasFactory; |
40
|
|
|
use SoftDeletes; |
41
|
|
|
use HasUuid; |
42
|
|
|
|
43
|
|
|
protected $table = 'files'; |
44
|
|
|
|
45
|
|
|
protected $fillable = [ |
46
|
|
|
'model_id', |
47
|
|
|
'model_type', |
48
|
|
|
'category', |
49
|
|
|
'filename', |
50
|
|
|
'original_filename', |
51
|
|
|
'size', |
52
|
|
|
'path', |
53
|
|
|
'mime_type', |
54
|
|
|
'source', |
55
|
|
|
]; |
56
|
|
|
|
57
|
|
|
protected $casts = [ |
58
|
|
|
'size' => 'int', |
59
|
|
|
'model_id' => 'int', |
60
|
|
|
]; |
61
|
|
|
|
62
|
|
|
public function model(): MorphTo |
63
|
|
|
{ |
64
|
|
|
return $this->morphTo('model'); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @codeCoverageIgnore |
69
|
|
|
*/ |
70
|
|
|
protected static function newFactory(): FileFactory |
71
|
|
|
{ |
72
|
|
|
return FileFactory::new(); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function getFilesystemDisk(): Filesystem | FilesystemManager |
76
|
|
|
{ |
77
|
|
|
return Storage::disk($this->source ?: null); |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths