Example #1
0
 /**
  * Set new name for file
  *
  * @param string $name
  * @return $this
  */
 public function setName($name)
 {
     $this->file->name = Str::slug($name);
     $this->file->full_name = $this->fullName();
     if ($this->getPath()) {
         $this->updateUrl();
     }
     return $this;
 }
Example #2
0
 /**
  * Set folder name
  *
  * @param $name
  * @return $this
  */
 public function setName($name)
 {
     if ($name !== '..') {
         $this->folder->name = Str::slug($name);
         $this->folder->full_name = $this->folder->name;
     } else {
         $this->folder->name = null;
         $this->folder->full_name = '..';
     }
     return $this;
 }
Example #3
0
 /**
  * Get thumb File or folder full system path
  *
  * @param $size
  * @param File|null $file
  * @return string
  */
 public function thumbPath($size, File $file = null)
 {
     $thumb_path = [$this->sys_path, $this->thumbDirName(), Str::slug($size)];
     if (!is_null($file)) {
         $thumb_path[] = $file->fullName();
     }
     return FileSystem::join($thumb_path);
 }
 /**
  * @param int|string|array $permission
  * @param IHasRole $model
  *
  * @return bool
  */
 private function hasAllCripPermissions($permission, IHasRole $model)
 {
     foreach (Str::toArray($permission) as $role) {
         if (!$model->hasPermission($role)) {
             return false;
         }
     }
     return true;
 }