Commit 5a6414f6 by Francisco Salazar

Initial commit

parents
{
"name": "onestartup/banner",
"description": "blog for websites onestartup",
"type": "library",
"license": "Apache-2.0",
"authors": [
{
"name": "Fco Salazar",
"email": "[email protected]"
}
],
"minimum-stability": "dev",
"require": {},
"autoload": {
"psr-4": {"Onestartup\\Slider\\": "src"}
}
}
<?php
namespace Onestartup\Slider;
use Illuminate\Support\ServiceProvider;
class SliderServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
include __DIR__.'/routes.php';
$this->loadMigrationsFrom(__DIR__.'/migrations');
$this->loadViewsFrom(__DIR__.'/views', 'slider');
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->app->make('Onestartup\Slider\Controller\AdminCarouselController');
}
}
\ No newline at end of file
<?php
namespace Onestartup\Slider\Controller;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Onestartup\Slider\Model\Carousel;
use Onestartup\Slider\Model\Slider;
use Onestartup\Slider\Requests\RequestCarousel;
class AdminCarouselController extends Controller{
public function index($slider_id){
$slider = Slider::findOrFail($slider_id);
$banners = Carousel::where("active", true)->where("slider_id", $slider->id);
$banners_desactivated = Carousel::where("active", false)->where("slider_id", $slider->id);
return view("slider::carousel.index")->with("slider", $slider)->with("banners", $banners)->with("banners_desactivated", $banners_desactivated);
}
public function create($slider_id){
$slider = Slider::findOrFail($slider_id);
return view("slider::carousel.create")->with("slider", $slider);
}
public function edit($slider_id, $id){
$slider = Slider::findOrFail($slider_id);
$carousel = $slider->carousels->where("id", $id)->first();
return view("slider::carousel.edit")->with("slider", $slider)->with("carousel", $carousel);
}
public function store(RequestCarousel $request, $slider_id){
$slider = Slider::findOrFail($slider_id);
$carousel = new Carousel($request->all());
$carousel->slider_id = $slider->id;
$max = Carousel::where("active", true)->count();
$carousel->position = $max +1;
$carousel->save();
if (isset($request->portada)) {
$file = $request->file('portada');
$nombre = $file->getClientOriginalName();
$nombre_file = str_replace(' ', '_', $nombre);
$ubicacion_donde_guarda ='carousel/' . $carousel->id . '/' . $nombre_file;
\Storage::disk('local')->put($ubicacion_donde_guarda, \File::get($file));
$carousel->image_path = $ubicacion_donde_guarda;
$carousel->save();
}
return redirect()
->route('sliders.admin.carousel.index', $slider->id)
->with('message_success', 'Banner agregado correctamente.');
}
public function update(RequestCarousel $request, $slider_id, $id){
$slider = Slider::findOrFail($slider_id);
$carousel = Carousel::where("id", $id)->where("slider_id", $slider->id)->first();
$carousel->fill($request->all());
$carousel->save();
if (isset($request->portada)) {
$file = $request->file('portada');
$nombre = $file->getClientOriginalName();
$nombre_file = str_replace(' ', '_', $nombre);
$ubicacion_donde_guarda ='carousel/'.$carousel->id."/".$nombre_file;
\Storage::disk('local')->put($ubicacion_donde_guarda, \File::get($file));
$carousel->image_path = $ubicacion_donde_guarda;
$carousel->save();
}
return redirect()
->back()
->with('message_success', 'Información actualizada correctamente.');
}
public function destroy($slider_id, $id){
$slider = Slider::findOrFail($slider_id);
$carousel = Carousel::where("id", $id)->where("slider_id", $slider->id)->first();
$carousel->delete();
return redirect()
->back()
->with('message_danger', 'Banner eliminado correctamente.');
}
public function deleteCover($id)
{
$carousel = Carousel::find($id);
$carousel->image_path = null;
$carousel->save();
return redirect()
->back()
->with('message_success', 'Imagen eliminada correctamente');
}
public function activate($slider_id, $id){
$slider = Slider::findOrFail($slider_id);
$carousel = Carousel::where("id", $id)->where("slider_id", $slider->id)->first();
$position_max = Carousel::where('active', true)->where("slider_id", $slider->id)->max('position') + 1;
$newstatus = !$carousel->active;
$carousel->position = $position_max;
$carousel->active = $newstatus;
$carousel->save();
if ($newstatus){
$message = "Banner activado correctamente.";
} else {
$message = "Banner desactivado correctamente.";
}
return redirect()
->back()
->with('message_success', $message);
}
}
\ No newline at end of file
<?php
namespace Onestartup\Slider\Controller;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Onestartup\Slider\Model\Slider;
use Onestartup\Slider\Model\Carousel;
use Onestartup\Slider\Requests\RequestSlider;
class AdminSliderController extends Controller{
public function index(){
$sliders = Slider::paginate(30);
$c_sliders = Slider::all()->count();
return view("slider::slider.index")->with("sliders", $sliders)->with("c_sliders", $c_sliders);
}
public function create(){
return view("slider::slider.create");
}
public function edit($id){
$slider = Slider::findOrFail($id);
return view("slider::slider.edit")->with("slider", $slider);
}
public function store(RequestSlider $request){
$slider = new Slider($request->all());
$slider->save();
return redirect()
->route('sliders.admin.carousel.index', $slider->id)
->with('message_success', 'Banner agregado correctamente.');
}
public function update(RequestSlider $request, $id){
$slider = Slider::findOrFail($id);
$slider->fill($request->all());
$slider->save();
return redirect()
->route("sliders.admin.slider.index")
->with('message_success', 'Información actualizada correctamente.');
}
public function destroy($id){
$slider = Slider::findOrFail($id);
$slider->delete();
return redirect()
->back()
->with('message_danger', 'Slider eliminado correctamente.');
}
public function sort(Request $request, $id){
$contents = explode("&",str_replace("id_banner[]=", "", $request->sort));
foreach ($contents as $index =>$content){
Carousel::find($content)->update(["position"=> $index + 1]);
}
return $contents;
}
}
\ No newline at end of file
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCarouselsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('carousels', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->string('subtitle')->nullable();
$table->string('description')->nullable();
$table->string('image_path', 455)->nullable();
$table->string('link', 455)->nullable();
$table->boolean('active')->default(true);
$table->integer('position');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('carousels');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSlidersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sliders', function (Blueprint $table) {
$table->increments('id');
$table->string("name");
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('sliders');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddSlidersToCarouselTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('carousels', function($table) {
$table->integer('slider_id')->unsigned();
$table->foreign('slider_id')->references('id')->on('sliders')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('carousels', function($table) {
$table->dropColumn('slider_id');
});
}
}
<?php
namespace Onestartup\Slider\Model;
use Illuminate\Database\Eloquent\Model;
class Carousel extends Model
{
protected $table = "carousels";
protected $fillable = ['title', 'subtitle', 'description', 'image_path', 'link', 'active', 'position'];
}
<?php
namespace Onestartup\Slider\Model;
use Illuminate\Database\Eloquent\Model;
class Slider extends Model
{
protected $table = "sliders";
protected $fillable = ['name'];
public function carousels(){
return $this->hasMany('Onestartup\Slider\Model\Carousel', 'slider_id');
}
public static function getSlides($name){
$slider = Slider::where("name", $name)->first();
if ($slider != null){
return $slider->carousels()->where("active", true)->orderBy("position")->get();
} else {
return "Slide no existente.";
}
}
}
<?php
namespace Onestartup\Slider\Requests;
use Illuminate\Foundation\Http\FormRequest;
class RequestCarousel extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'title' => 'required|max:255',
'subtitle' => 'max:255',
'description'=> 'max:255',
'link' => 'max:455',
'portada' => 'image',
];
}
}
\ No newline at end of file
<?php
namespace Onestartup\Slider\Requests;
use Illuminate\Foundation\Http\FormRequest;
class RequestSlider extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|max:255',
];
}
}
\ No newline at end of file
<?php
Route::group(['middleware' => ['web', 'auth', 'is_admin']], function(){
Route::resource('admin/slider/slider', 'Onestartup\Slider\Controller\AdminSliderController', ['as'=>'sliders.admin', 'except'=>'show']);
Route::resource('admin/slider/slider/{slider}/carousel', 'Onestartup\Slider\Controller\AdminCarouselController', ['as'=>'sliders.admin', 'except'=>'show']);
Route::delete('admin/slider/carousel/delete_image/{id}', 'Onestartup\Slider\Controller\AdminCarouselController@deleteCover')
->name('sliders.admin.carousel.delete_image');
Route::post('admin/slider/slider/{slider}/carousel/{id}/activate/', 'Onestartup\Slider\Controller\AdminCarouselController@activate')
->name('sliders.admin.carousel.activate');
Route::post('admin/slider/slider/{slider}/sort', 'Onestartup\Slider\Controller\AdminSliderController@sort')
->name('sliders.admin.slider.sort');
});
\ No newline at end of file
@extends('crm-admin::main-layout')
@section('breadcrumb')
<li class="breadcrumb-item">
<a href="{{route('home')}}">Home</a>
</li>
<li class="breadcrumb-item">
<a href="{{route('sliders.admin.slider.index')}}">Slider</a>
</li>
<li class="breadcrumb-item">
<a href="{{route('sliders.admin.slider.edit', $slider->id)}}">{{$slider->name}}</a>
</li>
<li class="breadcrumb-item">
<a href="{{route('sliders.admin.carousel.index', $slider->id)}}">Imagenes</a>
</li>
<li class="breadcrumb-item active">
Crear nuevo banner
</li>
@endsection
@section('content')
<div class='row'>
<div class='col-md-12'>
<div class='box'>
<div class='box-header dark'>
<h2>Agregar información</h2>
</div>
<div class='box-body'>
{!! Form::open(['route'=> ['sliders.admin.carousel.store', $slider->id],'method'=>'POST', "id"=>"target", 'enctype'=>'multipart/form-data']) !!}
@include('slider::carousel.fields')
</div>
<div class='dker p-a text-right'>
<div class='col-md-12'>
<a class='btn danger' href="{{route('sliders.admin.carousel.index', $slider->id)}}" style='margin-right:10px'>Cancelar</a>
<button class='btn dark' type='submit'>
Registrar
</button>
{!! Form::close() !!}
</div>
</div>
</div>
</div>
</div>
@endsection
@extends('crm-admin::main-layout')
@section('breadcrumb')
<li class="breadcrumb-item">
<a href="{{route('home')}}">Home</a>
</li>
<li class="breadcrumb-item">
<a href="{{route('sliders.admin.slider.index')}}">Slider</a>
</li>
<li class="breadcrumb-item">
<a href="{{route('sliders.admin.slider.edit', $slider->id)}}">{{$slider->name}}</a>
</li>
<li class="breadcrumb-item">
<a href="{{route('sliders.admin.carousel.index', $slider->id)}}">Imagenes</a>
</li>
<li class="breadcrumb-item active">
{{$carousel->title}}
</li>
@endsection
@section('content')
<div class='row'>
<div class='col-md-12'>
<div class='box'>
<div class='box-header dark'>
<h2>Agregar información</h2>
</div>
<div class='box-body'>
{!! Form::model($carousel,['route'=> ['sliders.admin.carousel.update',$slider->id,$carousel->id],"method"=>"PUT", 'enctype'=>'multipart/form-data']) !!}
@include('slider::carousel.fields')
</div>
<div class='dker p-a text-right'>
<div class='col-md-12'>
<a class='btn danger' href="{{route('sliders.admin.carousel.index', $slider->id)}}" style='margin-right:10px'>Cancelar</a>
<button class='btn dark' type='submit'>
Registrar
</button>
{!! Form::close() !!}
</div>
</div>
</div>
</div>
</div>
<div class='modal fade' data-backdrop='true' id='ver'>
<div class='modal-dialog modal-lg'>
<div class='modal-content box-shadow-z3'>
<div class='modal-body text-center p-lg'>
@if ($carousel->image_path == null)
<h4> No hay imagen asignada</h4>
@else
<img class='image-modal-preview' src="{{asset('storage/'.$carousel->image_path)}}">
@endif
</div>
<div class='modal-footer'>
<button class='btn dark p-x-md' data-dismiss='modal' type='button'>Cerrar</button>
@if($carousel->image_path != null)
{!! Form::open(['route'=> ['sliders.admin.carousel.delete_image',$carousel->id],'method'=>'DELETE'])!!}
<button class='btn btn-danger button-mb' onclick="return confirm('¿Estás seguro de eliminar este elemento?');" type='submit'>
<i class='fas fa-trash-alt icon-special-size'>
Eliminar
</i>
</button>
{!! Form::close()!!}
@endif
</div>
</div>
<!-- /.modal-content -->
</div>
</div>
@endsection
\ No newline at end of file
<div class="row">
<div class="col-md-12">
<div class="form-group">
{!! Form::label('title', 'Título: *') !!}
{!! Form::text('title', null, ["class"=>"form-control", "required"=>"required", "placeholder"=>"Escribe aquí el titulo del banner"]) !!}
</div>
<div class="form-group">
{!! Form::label('subtitle', 'Subtítulo:') !!}
{!! Form::text('subtitle', null, ["class"=>"form-control", "placeholder"=>"Escribe aquí el subtítulo del banner"]) !!}
</div>
<div class="form-group">
{!! Form::label('description', 'Descripción:') !!}
{!! Form::text('description', null, ["class"=>"form-control", "placeholder"=>"Escribe aquí informacion adicional para el banner"]) !!}
</div>
<div class="form-group">
{!! Form::label('link', 'Liga (URL):') !!}
{!! Form::text('link', null, ["class"=>"form-control", "placeholder"=>"Escribe aquí la liga del banner"]) !!}
</div>
</div>
<div class="col-md-6">
{!! Form::label('portada', 'Imagén:') !!}
{!! Form::file('portada', null, ["class"=>"form-control"]) !!}
</div>
<div class="col-md-6">
<center>
@if (isset($carousel->image_path))
<a data-target="#ver" data-toggle="modal" href="#" ui-toggle-class="fade-up-big">
<img src="{{ asset('storage/'.$carousel->image_path) }} " width="150px">
</a>
@endif
</center>
<br>
</div>
</div>
\ No newline at end of file
@extends('crm-admin::main-layout')
@section('breadcrumb')
<li class="breadcrumb-item">
<a href="{{route('home')}}">Home</a>
</li>
<li class="breadcrumb-item">
<a href="{{route('sliders.admin.slider.index')}}">Slider</a>
</li>
<li class="breadcrumb-item">
<a href="{{route('sliders.admin.slider.edit', $slider->id)}}">{{$slider->name}}</a>
</li>
<li class="breadcrumb-item active">
Carousel
</li>
@endsection
@section('content')
<input type="hidden" value="{{ csrf_token() }}" id="_token"/>
<div class='row'>
<div class='col-md-12'>
<div class='box'>
<div class='box-header dark'>
<h2>
Imágenes del slider
<span>
<a class='btn btn-xs btn-info button-ml' href="{{route('sliders.admin.carousel.create', $slider->id)}}">
<i class='fas fa-plus'></i>
Agregar imagen
</a>
</span>
</h2>
</div>
<div class='box-body'>
<div class='col-md-12'>
<table class='table'>
<tr>
<th width="10%" class="text-center">#</th>
<th width="20%" class="text-center">Título</th>
<th width="25%" class="text-center">Subtítulo</th>
<th width="25%" class="text-center">Imagen</th>
<th width="20%" class="text-center"></th>
</tr>
<tbody class="sortable" data-update-url="{{route('sliders.admin.slider.sort', $slider->id)}}">
@if ($banners->count() > 0)
@foreach($banners->orderBy("position")->get() as $banner)
<tr id="id_banner_{{$banner->id}}">
<td>
<a class="btn btn-default handle-sort" type="button">
<i class="fas fa-arrows-alt"></i> Mover
</a>
</td>
<td>{{$banner->title}}</td>
<td>{{$banner->subtitle}}</td>
<td class="text-center">
@if($banner->image_path != null)
<img src="{{asset('storage/'.$banner->image_path)}}" width="100%">
@else
No imagen
@endif
</td>
<td class="text-center">
{!! Form::open(['route'=> ['sliders.admin.carousel.destroy',$slider->id, $banner->id],'method'=>'DELETE'])!!}
<button class='btn btn-danger btn-xs button-mb' onclick="return confirm('¿Estás seguro de eliminar este elemento?');" type='submit'>
<i class='fas fa-trash-alt icon-special-size'></i>
Eliminar
</button>
{!! Form::close()!!}
{!! Form::open(['route'=> ['sliders.admin.carousel.activate',$slider->id,$banner->id],'method'=>'POST'])!!}
<button class='btn btn-info btn-xs button-mb' onclick="return confirm('¿Estás seguro que deseas desactivar este elemento?');" type='submit'>
<i class='fas fa-arrow-down icon-special-size'></i>
Desactivar
</button>
{!! Form::close()!!}
<a class='btn btn-xs accent' href="{{route('sliders.admin.carousel.edit',[ $slider->id, $banner->id])}}">
<i class='fas fa-edit icon-special-size'></i>
Editar
</a>
</td>
</tr>
@endforeach
@else
<tr>
<td colspan="5" class="text-center">No hay banners registrados</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class='dker p-a text-right'>
</div>
</div>
</div>
</div>
<div class='row'>
<div class='col-md-12'>
<div class='box'>
<div class='box-header dark'>
<h2>
Imágenes del carousel (Desactivadas)
</h2>
</div>
<div class='box-body'>
<div class='col-md-12'>
<table class='table'>
<tr>
<th width="10%" class="text-center">#</th>
<th width="20%" class="text-center">Título</th>
<th width="25%" class="text-center">Subtítulo</th>
<th width="25%" class="text-center">Imagen</th>
<th width="20%" class="text-center"></th>
</tr>
@if ($banners_desactivated->count() > 0 )
@foreach($banners_desactivated->get() as $banner)
<tr>
<td>{{$banner->id}}</td>
<td>{{$banner->title}}</td>
<td>{{$banner->subtitle}}</td>
<td class="text-center">
@if($banner->image_path != null)
<img src="{{asset('storage/'.$banner->image_path)}}" width="100%">
@else
No imagen
@endif
</td>
<td class="text-center">
{!! Form::open(['route'=> ['sliders.admin.carousel.destroy',$slider->id,$banner->id],'method'=>'DELETE'])!!}
<button class='btn btn-danger btn-xs button-mb' onclick="return confirm('¿Estás seguro de eliminar este elemento?');" type='submit'>
<i class='fas fa-trash-alt icon-special-size'></i>
Eliminar
</button>
{!! Form::close()!!}
{!! Form::open(['route'=> ['sliders.admin.carousel.activate',$slider->id,$banner->id],'method'=>'POST'])!!}
<button class='btn btn-info btn-xs button-mb' onclick="return confirm('¿Estás seguro que deseas activar este elemento?');" type='submit'>
<i class='fas fa-arrow-up icon-special-size'></i>
Activar
</button>
{!! Form::close()!!}
<a class='btn btn-xs accent' href="{{route('sliders.admin.carousel.edit', [$slider->id, $banner->id])}}">
<i class='fas fa-edit icon-special-size'></i>
Editar
</a>
</td>
</tr>
@endforeach
@else
<tr>
<td colspan="5" class="text-center">No hay banners desactivados</td>
</tr>
@endif
</table>
</div>
</div>
<div class='dker p-a text-right'>
</div>
</div>
</div>
</div>
@endsection
@section('script_extras')
<script type="text/javascript">
$(document).ready(function() {
var CSRF_TOKEN = $('#_token').val();
console.log("fhsjkdfhjskd");
$('.sortable').sortable({
axis: 'y',
placeholder: "sortable-placeholder",
handle: '.handle-sort',
update: function(){
var parametros = {"_token" : CSRF_TOKEN, "sort" : $(this).sortable('serialize')}
var URL = $(this).data('update-url');
$.ajax({
data : parametros,
url : URL,
method : "POST",
success : function(response){
console.log("fdsfsd")
console.log(response);
},
error : function (error){
console.log(error);
},
});
}
});
});
</script>
@endsection
\ No newline at end of file
<p>
{{Slide::getSlides("-inserta el nombre del slide-")}}
</p>
\ No newline at end of file
@extends('crm-admin::main-layout')
@section('breadcrumb')
<li class="breadcrumb-item">
<a href="{{route('home')}}">Home</a>
</li>
<li class="breadcrumb-item">
<a href="{{route('sliders.admin.slider.index')}}">Slider</a>
</li>
<li class="breadcrumb-item active">
Crear nuevo slider
</li>
@endsection
@section('content')
<div class='row'>
<div class='col-md-12'>
<div class='box'>
<div class='box-header dark'>
<h2>Agregar información</h2>
</div>
<div class='box-body'>
{!! Form::open(['route'=> 'sliders.admin.slider.store','method'=>'POST', "id"=>"target", 'enctype'=>'multipart/form-data']) !!}
@include('slider::slider.fields')
</div>
<div class='dker p-a text-right'>
<div class='col-md-12'>
<a class='btn danger' href="{{route('sliders.admin.slider.index')}}" style='margin-right:10px'>Cancelar</a>
<button class='btn dark' type='submit'>
Registrar
</button>
{!! Form::close() !!}
</div>
</div>
</div>
</div>
</div>
@endsection
@extends('crm-admin::main-layout')
@section('breadcrumb')
<li class="breadcrumb-item">
<a href="{{route('home')}}">Home</a>
</li>
<li class="breadcrumb-item">
<a href="{{route('sliders.admin.slider.index')}}">Slider</a>
</li>
<li class="breadcrumb-item">
<a href="{{route('sliders.admin.slider.index')}}">Sliders</a>
</li>
<li class="breadcrumb-item active">
{{$slider->name}}
</li>
@endsection
@section('content')
<div class='row'>
<div class='col-md-12'>
<div class='box'>
<div class='box-header dark'>
<h2>Agregar información</h2>
</div>
<div class='box-body'>
{!! Form::model($slider,['route'=> ['sliders.admin.slider.update',$slider->id],"method"=>"PUT", 'enctype'=>'multipart/form-data']) !!}
@include('slider::slider.fields')
</div>
<div class='dker p-a text-right'>
<div class='col-md-12'>
<a class='btn danger' href="{{route('sliders.admin.slider.index')}}" style='margin-right:10px'>Cancelar</a>
<button class='btn dark' type='submit'>
Registrar
</button>
{!! Form::close() !!}
</div>
</div>
</div>
</div>
</div>
@endsection
\ No newline at end of file
<div class="row">
<div class="col-md-12">
<div class="form-group">
{!! Form::label('name', 'Nombre del slider: *') !!}
{!! Form::text('name', null, ["class"=>"form-control", "required"=>"required", "placeholder"=>"Escribe aquí el nombre del slider"]) !!}
</div>
</div>
</div>
\ No newline at end of file
@extends('crm-admin::main-layout')
@section('breadcrumb')
<li class="breadcrumb-item">
<a href="{{route('home')}}">Home</a>
</li>
<li class="breadcrumb-item">
<a href="{{route('sliders.admin.slider.index')}}">Slider</a>
</li>
<li class="breadcrumb-item active">
Sliders
</li>
@endsection
@section("content")
<div class='row'>
<div class='col-md-12'>
<div class='box'>
<div class='box-header dark'>
<h2>
Sliders
<span>
<a class='btn btn-xs btn-info button-ml' href="{{route('sliders.admin.slider.create')}}">
<i class='fas fa-plus'></i>
Agregar slider
</a>
</span>
</h2>
</div>
<div class='box-body'>
<div class='col-md-12'>
<table class='table'>
<tr>
<th width="10%" class="text-center">#</th>
<th width="30%" class="text-center">Nombre</th>
<th width="30%" class="text-center">Imagenes</th>
<th width="30%"></th>
</tr>
<tbody class="sortable" data-update-url="/">
@if ($c_sliders > 0)
@foreach($sliders as $slider)
<tr>
<td>
{{$slider->id}}
</td>
<td>{{$slider->name}}</td>
<td>
<ul>
<li><strong>Imagenes: </strong> {{$slider->carousels()->where("active", true)->count()}}</li>
<li><strong>Imagenes (Deshabilitadas): </strong> {{$slider->carousels()->where("active", false)->count()}}</li>
</ul>
</td>
<td class="text-center">
<a class='btn btn-xs btn-success button-mb' href="{{route('sliders.admin.carousel.index', $slider->id)}}">
<i class='fas fa-plus icon-special-size'></i>
Banners
</a>
{!! Form::open(['route'=> ['sliders.admin.slider.destroy',$slider->id],'method'=>'DELETE'])!!}
<button class='btn btn-danger btn-xs button-mb' onclick="return confirm('¿Estás seguro de eliminar este elemento?');" type='submit'>
<i class='fas fa-trash-alt icon-special-size'></i>
Eliminar
</button>
{!! Form::close()!!}
<a class='btn btn-xs accent' href="{{route('sliders.admin.slider.edit', $slider->id)}}">
<i class='fas fa-edit icon-special-size'></i>
Editar
</a>
</td>
</tr>
@endforeach
@else
<tr>
<td colspan="3" class="text-center">No hay banners registrados</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class='dker p-a text-right'>
{!!$sliders->links()!!}
</div>
</div>
</div>
</div>
@endsection
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment