Skip to content

Commit

Permalink
Remove the physical file in the server
Browse files Browse the repository at this point in the history
  • Loading branch information
Roland Jeffrey Decena committed Feb 1, 2022
1 parent 47ae5ec commit d90ac92
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Shop\Categories\Repositories;

use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
use Jsdecena\Baserepo\BaseRepository;
use App\Shop\Categories\Category;
Expand Down Expand Up @@ -202,9 +203,15 @@ public function detachProducts()
* @param array $file
* @param null $disk
* @return bool
* @throws CategoryNotFoundException
*/
public function deleteFile(array $file, $disk = null) : bool
{
$category = $this->findCategoryById($file['category']);

// Remove the physical uploaded file
unlink(storage_path("app/public/$category->cover"));

return $this->update(['cover' => null]);
}

Expand Down
1 change: 1 addition & 0 deletions project/public/storage

0 comments on commit d90ac92

Please sign in to comment.