I've files in /public/images/ directory. It isn't allowing me to unlink files from the directory.
Try this:
if(file_exists($data->location)) {
unlink($data->location);
// this path should be public_path() not the url site path
}
Note
:- unlink function allow the public or storage path not allowing the site or url path for unlinking.
For example:
Allow this path:
C:\xampp\htdocs\laravel\public
Not allow this path: