Delete Directory Image - Laravel 5.1

1

I have the following code in my destroy method:

try{  
    Tecnico::find($id_tecnico)->delete();  
    DB::commit();
    return Redirect::back()->with('message', true);
}catch (\Exception $e){
    DB::rollback();
    return $this->renderHttpException($e);
}

How do I also delete an image that is linked to the technician being deleted?

The images are in the public folder, and the path / name is in a "signature" field of the table.

I think I would have to take this path and use some method to delete the file, but I do not know how to do this "delete".

    
asked by anonymous 13.04.2016 / 20:48

1 answer

2
// Deletar um arquivo

File::delete($filename);

// Deletar vários arquivos

File::delete($file1, $file2, $file3);

// Deletar um array de arquivos

$files = array($file1, $file2);

File::delete($files);

Source: link

    
13.04.2016 / 20:51