Commit 8688b994 by Angel MAS

stable version

parent adadb368
......@@ -141,15 +141,15 @@ class AdminProductController extends Controller
"<p class='mb0'>Fecha creación: <b>".$product->created_at->format('d/m/Y')."</b></p>";
})
->addColumn('form', function ($product) {
return "<form method='POST' action='".route('admin.product.destroy',$product->id)."'>".
return "<form method='POST' action='".route('admin.shop.product.destroy',$product->id)."'>".
"<input name='_method' type='hidden' value='DELETE' class='has-value'>".
csrf_field() .
"<button class='btn btn-danger btn-xs button-mb' onclick='return confirm();' type='submit'>".
"<i class='fas fa-trash-alt icon-special-size'></i>Eliminar</button>".
"</form>".
"<a href='".route('show.product', $product->slug)."' class='btn btn-xs info button-mb' target='new'>".
"<a href='".route('show.shop', $product->slug)."' class='btn btn-xs info button-mb' target='new'>".
"<i class='fas fa-eye icon-special-size'></i>Ver</a>".
"<br><a href='".route('admin.product.edit', $product->id)."' class='btn btn-xs accent mb0'>".
"<br><a href='".route('admin.shop.product.edit', $product->id)."' class='btn btn-xs accent mb0'>".
"<i class='fas fa-edit icon-special-size'></i>Editar</a>";
})
->rawColumns(['main', 'description', 'features', 'specifications', 'form'])
......
......@@ -6,8 +6,8 @@ use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Yajra\Datatables\Datatables;
use Onestartup\Product\Model\Product;
use Onestartup\Product\Model\ProductCategory as Category;
use Onestartup\Shop\Model\ProductShop as Product;
use Onestartup\Shop\Model\ProductCategoryShop as Category;
class ProductController extends Controller
{
......@@ -24,7 +24,7 @@ class ProductController extends Controller
$otros = Product::where('active', true)->inRandomOrder()->take(3)->get();
$categories = Category::where('active', true)->get();
return view('product-public::list')
return view('shop-public::list')
->with('categories', $categories)
->with('otros', $otros)
->with('products', $products);
......@@ -35,6 +35,7 @@ class ProductController extends Controller
{
$product = Product::where('slug',$slug)->first();
$otros = $product->category->products()->where('active', true)->take(3)->get();
$categories = Category::all();
......@@ -49,7 +50,7 @@ class ProductController extends Controller
return view('product-public::single')
return view('shop-public::single')
->with('product', $product)
->with('categories', $categories)
->with('otros', $otros);
......
......@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateProductCategoriesTable extends Migration
class CreateProductCategoriesShopTable extends Migration
{
/**
* Run the migrations.
......
......@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateProductsTable extends Migration
class CreateProductsShopTable extends Migration
{
/**
* Run the migrations.
......@@ -40,7 +40,7 @@ class CreateProductsTable extends Migration
$table->integer('category_id')->unsigned();
$table->foreign('category_id')
->references('id')
->on('product_categories')
->on('product_categories_shop')
->onDelete('cascade');
$table->integer('user_id')->unsigned();
......
......@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateProductImagesTable extends Migration
class CreateProductImagesShopTable extends Migration
{
/**
* Run the migrations.
......@@ -21,7 +21,7 @@ class CreateProductImagesTable extends Migration
$table->integer('product_id')->unsigned();
$table->foreign('product_id')
->references('id')
->on('products')
->on('products_shop')
->onDelete('cascade');
$table->timestamps();
......
......@@ -5,37 +5,37 @@ Route::group(['middleware' => ['web', 'auth', 'is_admin']], function(){
Route::resource('admin/shop/product', 'Onestartup\Shop\Controller\AdminProductController', ['as'=>'admin.shop']);
Route::resource('admin/shop/category', 'Onestartup\Shop\Controller\CategoryController', ['as'=>'admin.shop']);
Route::delete('delete/cover/category/product/{id}',
Route::delete('admin-shop-category/delete/cover{id}',
'Onestartup\Shop\Controller\CategoryController@deleteCover')
->name('delete.cover.category.shop');
->name('admin-shop-category.delete.cover');
Route::get('admin/products/datatable/shop',
Route::get('admin-shop-product/datatable',
'Onestartup\Shop\Controller\AdminProductController@getProducts')
->name('datatable.products.shop');
->name('admin-shop-product.datatable');
Route::post('admin/product/{id}/gallery',
Route::post('admin-shop-product/{id}/store/gallery',
'Onestartup\Shop\Controller\AdminProductController@storeGallery')
->name('admin.product.files.store.shop');
->name('admin-shop-product.store.gallery');
Route::delete('admin/product/delete/gallery/{id}',
Route::delete('admin-shop-product/delete/gallery/{id}',
'Onestartup\Shop\Controller\AdminProductController@deleteImage')
->name('admin.product.gallery.delete.shop');
->name('admin-shop-product.delete.gallery');
Route::delete('delete/cover/product/{id}',
Route::delete('admin-shop-product/delete/cover/{id}',
'Onestartup\Shop\Controller\AdminProductController@deleteCover')
->name('delete.cover.product.shop');
->name('admin-shop-product.delete.cover');
Route::get('admin/product/variable',
'Onestartup\Shop\Controller\AdminProductController@showVars')
->name('admin.product.variable.shop');
->name('admin-shop-product.view.vars');
Route::post('admin/product/variable',
'Onestartup\Shop\Controller\AdminProductController@postVars')
->name('admin.product.variable.store.shop');
->name('admin-shop-product.store.vars');
});
Route::group(['middleware' => ['web']], function(){
Route::get('producto/{slug}', 'Onestartup\Shop\Controller\ProductController@show')->name('show.product');
Route::get('productos', 'Onestartup\Shop\Controller\ProductController@index')->name('main.product');
Route::get('producto/{slug}', 'Onestartup\Shop\Controller\ProductController@show')->name('show.shop');
Route::get('productos', 'Onestartup\Shop\Controller\ProductController@index')->name('main.shop');
});
......@@ -34,7 +34,7 @@
<div class="row">
<div class="col-md-6">
{!! Form::open(['route'=> ['admin.product.files.store.shop', $product->id], 'method' => 'POST', 'files'=>'true', 'id' => 'my-dropzone' , 'class' => 'dropzone']) !!}
{!! Form::open(['route'=> ['admin-shop-product.store.gallery', $product->id], 'method' => 'POST', 'files'=>'true', 'id' => 'my-dropzone' , 'class' => 'dropzone']) !!}
<div class="dz-message" style="height:200px;">
Arrastra las imagenes aqui
</div>
......@@ -49,7 +49,7 @@
@foreach($product->images as $img)
<div class="col-md-4">
<img src="{{$img->path}}" width="100%">
{!! Form::open(['route'=> ['admin.product.gallery.delete.shop',$img->id],'method'=>'DELETE'])!!}
{!! Form::open(['route'=> ['admin-shop-product.delete.gallery',$img->id],'method'=>'DELETE'])!!}
<button class='btn btn-danger btn-block' onclick="return confirm('¿Estás seguro de eliminar este elemento?');" type='submit'>
<i class='fas fa-trash-alt icon-special-size'></i>
Eliminar
......@@ -80,7 +80,7 @@
<div class='modal-footer'>
<button class='btn dark p-x-md' data-dismiss='modal' type='button'>Cerrar</button>
@if($product->cover != null)
{!! Form::open(['route'=> ['delete.cover.product.shop',$product->id],'method'=>'DELETE'])!!}
{!! Form::open(['route'=> ['admin-shop-product.delete.cover',$product->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'></i>
Eliminar
......
......@@ -41,7 +41,7 @@
processing: true,
serverSide: true,
pageLength: 25,
ajax: '{{ route("datatable.products.shop") }}',
ajax: '{{ route("admin-shop-product.datatable") }}',
columns: [
{data: 'id', name: 'id'},
{data: 'main', name: 'main'},
......
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInite3f07afc9e0644e3bd44afb33ef4bd3d::getLoader();
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Onestartup\\Shop\\' => array($baseDir . '/src'),
);
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInite3f07afc9e0644e3bd44afb33ef4bd3d
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInite3f07afc9e0644e3bd44afb33ef4bd3d', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInite3f07afc9e0644e3bd44afb33ef4bd3d', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInite3f07afc9e0644e3bd44afb33ef4bd3d::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
return $loader;
}
}
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInite3f07afc9e0644e3bd44afb33ef4bd3d
{
public static $prefixLengthsPsr4 = array (
'O' =>
array (
'Onestartup\\Shop\\' => 16,
),
);
public static $prefixDirsPsr4 = array (
'Onestartup\\Shop\\' =>
array (
0 => __DIR__ . '/../..' . '/src',
),
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInite3f07afc9e0644e3bd44afb33ef4bd3d::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInite3f07afc9e0644e3bd44afb33ef4bd3d::$prefixDirsPsr4;
}, null, ClassLoader::class);
}
}
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