This commit is contained in:
Kevin Adametz 2020-05-06 15:52:59 +02:00
parent 68b9d1ff88
commit b9c26d06d0
75 changed files with 2143 additions and 818 deletions

View file

@ -100,6 +100,16 @@ class FileRepository extends BaseRepository {
], 200);
}
public function delete(){
if($this->model){
if(Storage::disk($this->disk)->exists( $this->model->dir.$this->model->filename )){
Storage::disk($this->disk)->delete($this->model->dir.$this->model->filename);
}
$this->model->delete();
return true;
}
return false;
}
private function makeFilename(){
$originalNameWithoutExt = substr($this->originalName, 0, strlen($this->originalName) - strlen($this->extension) - 1);
$this->filename = Util::sanitize($originalNameWithoutExt, true, false, true);