Delete Directory Image - Laravel 5.1

Asked

Viewed 1,057 times

1

I have in my method the following code:

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 that is 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 then I don’t know how to do this "delete".

1 answer

2


Browser other questions tagged

You are not signed in. Login or sign up in order to post.