Sindbad~EG File Manager

Current Path : /var/www/html/desafiatebasa.sumar.com.py/app/Http/Livewire/
Upload File :
Current File : /var/www/html/desafiatebasa.sumar.com.py/app/Http/Livewire/Fotos.php

<?php

namespace App\Http\Livewire;

use Livewire\Component;
use App\Models\Galeria;
use App\Models\Foto;
use Livewire\WithPagination;
use Livewire\WithFileUploads;

class Fotos extends Component{

    use WithFileUploads;

    use WithPagination;

    protected $paginationTheme = 'bootstrap';

    public $vista,$album_id;

    public function render(){
        $album=Galeria::find($this->album_id);

        $fotos=Foto::where('categoria_id',$this->album_id)->paginate(20);

        return view('livewire.fotos',["album"=>$album,"fotos"=>$fotos]);
    }

    public function delete($id){
        if($id){
            
            $foto = Foto::find($id);

            if(unlink(public_path().'/images/galeria/'.$foto->foto)) {
                $foto->delete();
            }
            
            $this->emit('alert', ['type' => 'error', 'message' => '¡La imagen se elimino correctamente.!']);

        }
    }
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists