unlink does not work


You see, I have a table Photo with these values:

    Schema::create('fotos', function(Blueprint $table){
        $table->unsignedInteger('categoria_id'); // Forarea de Categoria.
        $table->unsignedInteger('user_id'); // Foranea de User.

The variable foto is the one that stores the image, which is in public/archivo , and I access it using this variable:

public function ruta(){
    return asset("archivo/".$this->foto);

It turns out that I want that after deleting a photo, the image stored in the folder is also deleted. This is the function:

public function eliminar(Foto $f){
        return back()->with('message',['success',"La foto ha sido eliminada de la base de datos"]);

And this is the function that removes the image from the folder:

public function limpiarImagen(){

But the image is not deleted. How do I solve it?

asked by Miguel Alparez 07.12.2018 в 12:34

0 answers