@extends('admin.index')
@section('content')
@php
use App\Models\Admin;
use Spatie\Permission\Models\Role;
@endphp
  <title>{{trans('admin.DataBases')}}</title>

 <main id="js-page-content" role="main" class="page-content">
                    <ol class="breadcrumb page-breadcrumb">
                        <li class="breadcrumb-item active">{{trans('admin.DataBases')}}</li>
                        <li class="position-absolute pos-top pos-right d-none d-sm-block"><span
                                class="js-get-date"></span></li>
                    </ol>
                    <div class="subheader">

                    </div>
                    <div class="row">
                        <div class="col-xl-12">
                            <div id="panel-1" class="panel">
                                <div class="panel-hdr">
                                    <h2>
                                        <span class="fw-300"><i> {{trans('admin.DataBases')}}</i></span>
                                    </h2>

                                    <div class="panel-toolbar">

                            <button class="btn btn-primary btn-sm mx-3" data-toggle="dropdown">Table Style</button>
                @include('admin.layouts.toolbar')
                                    </div>
                                </div>
                                <div class="panel-container show">
                                      <span id="ex"> @include('admin.layouts.messages')</span>
                                    <div class="panel-content">
                                        <!-- datatable start -->
                                        <div id="mobile-overflow">
                                        <table id="dt-basic-example"
                                            class="table table-bordered table-hover table-striped mobile-width">
                                            <thead class="bg-highlight">
                                                <tr>
                                                    <th>{{trans('admin.Version')}}</th>
                                                    <th>{{trans('admin.Delete')}}</th>
                                                </tr>
                                            </thead>
                                            <tbody>

                                    @php
                             $Xs = File::files(public_path());

                                 @endphp

                               @foreach($Xs as $x)

                @php


$needle = "public/";
$newString = strstr($x, $needle);
    $lastWord=str_replace('public/', '', $newString);

                        $lasrString = strstr($lastWord, '.');

                            @endphp

                            @if($lasrString == '.sql')
                                <tr>
                                <td>
                          <a href="{{asset($lastWord)}}" download class="btn btn-primary">
                        <i class="fal fa-download"></i>




                              {{$lastWord}}


                               </a>
                                </td>
                                <td>
                        <form action="{{url('DeleteBackup')}}">
                        <input type="hidden" name="X" value="{{$x}}">
                                     <button type="submit"  class="btn btn-danger">
                                <i class="fal fa-trash"></i>
                                    </button>
                                    </form>

                                </td>

                                </tr>
                                            @endif
                               @endforeach


                                            </tbody>
                                        </table>
                                        </div>
                                        <!-- datatable end -->
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>




                </main>
@endsection

