mostafaznv /
larupload
| 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
Bug
introduced
by
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 |