/**
  * Handle the command.
  *
  * @param BreadcrumbCollection $breadcrumbs
  */
 public function handle(BreadcrumbCollection $breadcrumbs)
 {
     $disk = $this->folder->getDisk();
     $uri = 'admin/files/browser/' . $disk->getSlug();
     foreach (explode('/', $this->folder->path()) as $name) {
         $breadcrumbs->add($name, $uri = $uri . '/' . $name);
     }
 }
Ejemplo n.º 2
0
 /**
  * Handle the command.
  *
  * @param MountManager $manager
  */
 public function handle(MountManager $manager)
 {
     if (!($disk = $this->folder->getDisk())) {
         return;
     }
     if (!$this->folder->isForceDeleting()) {
         return;
     }
     $manager->deleteDir($disk->getSlug() . '://' . $this->folder->getSlug());
 }
Ejemplo n.º 3
0
 /**
  * Upload a file.
  *
  * @param UploadedFile    $file
  * @param FolderInterface $folder
  * @return bool|FileInterface
  */
 public function upload(UploadedFile $file, FolderInterface $folder)
 {
     $rules = 'required';
     if ($allowed = $folder->getAllowedTypes()) {
         $rules .= '|mimes:' . implode(',', $allowed);
     }
     $validation = $this->validator->make(['file' => $file], ['file' => $rules]);
     if (!$validation->passes()) {
         return false;
     }
     $disk = $folder->getDisk();
     /* @var FileInterface $entry */
     $entry = $this->manager->put($disk->getSlug() . '://' . $folder->getSlug() . '/' . $file->getClientOriginalName(), file_get_contents($file->getRealPath()));
     if (in_array($entry->getExtension(), $this->config->get('anomaly.module.files::mimes.types.image'))) {
         $size = getimagesize($file->getRealPath());
         $this->files->save($entry->setAttribute('width', $size[0])->setAttribute('height', $size[1]));
     }
     return $entry;
 }
Ejemplo n.º 4
0
 /**
  * Return the browser link.
  *
  * @return string
  */
 public function viewLink()
 {
     return app('html')->link(implode('/', array_filter(['admin', 'files', 'browser', $this->object->getDisk()->getSlug(), $this->object->path()])), $this->object->getName());
 }
Ejemplo n.º 5
0
 /**
  * Handle the command.
  *
  * @param MountManager $manager
  */
 public function handle(MountManager $manager)
 {
     $disk = $this->folder->getDisk();
     $manager->deleteDir($disk->getSlug() . '://' . $this->folder->getSlug());
 }