Laravel Delete Directory from Storage Example
Sep 26, 2019
Hi Dev,
In this article, i will show you how to remove folder in Laravel.you can delete directory then use deleteDirectory() with File object.
You can get your delete folder path thenafter you use your get path in function.
The method will return true if it succeeds, false if it fails.
Example for Laravel
First you can create folder public/test/demo.
public function index()
{
$folderPath = public_path('test');
$dd = File::deleteDirectory($folderPath);
dd($dd);
}
If return true this method success, return false this method fails.
Example for PHP
public function index()
{
$folderPath = public_path('test');
$dd = rmdir($folderPath);
dd($dd);
}
If return true this method success, return false this method fails.
It will help you....
- How to Notifications With database Driver in Laravel 11?
- How to Send Email Via Notification in Laravel 11?
- How to Install and Configure Laravel 11 Debugbar?
- How to Like Dislike System in Laravel 11?
- How to Paginate a Model with Relationship in Laravel 11?
- Laravel 11 Upload Files to Amazon S3 Example
- Laravel 11 Send WhatsApp Messages Example
- Laravel 11 Rest API Authentication Using JWT Tutorial