Issues (177)

src/Concerns/BaseLarupload.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Mostafaznv\Larupload\Concerns;
4
5
use Mostafaznv\Larupload\Storage\Attachment;
6
use Mostafaznv\Larupload\Storage\Proxy\AttachmentProxy;
7
8
trait BaseLarupload
9
{
10
    protected static string $laruploadNull;
11
12
    private bool $hideLaruploadColumns;
13
14
    /**
15
     * @var Attachment[]
16
     */
17
    private array $attachments = [];
18
19
    protected function initializeLarupload(): void
20
    {
21
        $this->hideLaruploadColumns = config('larupload.hide-table-columns');
22
23
        $this->attachments = $this->attachments();
24
        $table = $this->getTable();
0 ignored issues
show
It seems like getTable() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        /** @scrutinizer ignore-call */ 
25
        $table = $this->getTable();
Loading history...
25
26
        foreach ($this->attachments as $attachment) {
27
            $attachment->folder($table);
28
        }
29
    }
30
31
    public static function bootLarupload(): void
32
    {
33
        static::$laruploadNull = crc32(time());
34
35
        if (!defined('LARUPLOAD_NULL')) {
36
            define('LARUPLOAD_NULL', static::$laruploadNull);
37
        }
38
    }
39
40
    /**
41
     * Get the entities should upload into the model
42
     *
43
     * @return Attachment[]
44
     */
45
    abstract public function attachments(): array;
46
}
47