|
@@ -19,6 +19,7 @@ trait HasAllegato
|
|
|
public $allegatiDocumenti;
|
|
public $allegatiDocumenti;
|
|
|
public $allegati = [];
|
|
public $allegati = [];
|
|
|
|
|
|
|
|
|
|
+ protected $imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg', 'webp'];
|
|
|
|
|
|
|
|
public function getAllegatoType($type)
|
|
public function getAllegatoType($type)
|
|
|
{
|
|
{
|
|
@@ -43,6 +44,16 @@ trait HasAllegato
|
|
|
|
|
|
|
|
public function saveAllegato()
|
|
public function saveAllegato()
|
|
|
{
|
|
{
|
|
|
|
|
+ if ($this->allegatoGallery == 1) {
|
|
|
|
|
+ foreach ($this->allegatiFiles as $file) {
|
|
|
|
|
+ $extension = pathinfo($file, PATHINFO_EXTENSION);
|
|
|
|
|
+ if (!in_array(strtolower($extension), $this->imageExtensions)) {
|
|
|
|
|
+ session()->flash('error', 'I File devono essere immagini per Tipologia: foto sinistro');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$files = implode("|", $this->allegatiFiles);
|
|
$files = implode("|", $this->allegatiFiles);
|
|
|
|
|
|
|
|
if ($this->allegatoId > 0) {
|
|
if ($this->allegatoId > 0) {
|