rename models and associates, isolate botanic with shop
This commit is contained in:
@@ -4,13 +4,13 @@ namespace App\DataTables;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Product;
|
||||
use App\Models\Shop\Article;
|
||||
|
||||
class ProductsDataTable extends DataTable
|
||||
class ArticlesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Products';
|
||||
public $model_name = 'Articles';
|
||||
|
||||
public function query(Product $model)
|
||||
public function query(Article $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
30
app/Datatables/CategoriesDataTable.php
Normal file
30
app/Datatables/CategoriesDataTable.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Category;
|
||||
|
||||
class CategoriesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Categories';
|
||||
|
||||
public function query(Category $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(120)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,16 +12,18 @@ class SpeciesDataTable extends DataTable
|
||||
|
||||
public function query(Specie $model)
|
||||
{
|
||||
$model = $model::withCount('varieties')->with('genre');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('alias'),
|
||||
Column::make('genre_name'),
|
||||
Column::make('latin'),
|
||||
Column::make('genre'),
|
||||
Column::make('varieties_count')->title('Nb variétés'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
namespace App\Http\Controllers\Botanic\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Families;
|
||||
use App\Repositories\Botanic\Families;
|
||||
use App\DataTables\FamiliesDataTable;
|
||||
|
||||
class FamilyController extends Controller
|
||||
@@ -13,7 +13,7 @@ class FamilyController extends Controller
|
||||
|
||||
public function index(FamiliesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Shop.Admin.Families.list');
|
||||
return $dataTable->render('Botanic.Admin.Families.list');
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
@@ -24,25 +24,25 @@ class FamilyController extends Controller
|
||||
public function create()
|
||||
{
|
||||
$data = [];
|
||||
return view('Shop.Admin.Families.create', $data);
|
||||
return view('Botanic.Admin.Families.create', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Families::store($request);
|
||||
return redirect()->route('Shop.Admin.Families.index');
|
||||
return redirect()->route('Botanic.Admin.Families.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = Families::get($id);
|
||||
return view('Shop.Admin.Families.view', $data);
|
||||
return view('Botanic.Admin.Families.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data['family'] = Families::get($id)->toArray();
|
||||
return view('Shop.Admin.Families.edit', $data);
|
||||
return view('Botanic.Admin.Families.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
@@ -1,19 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
namespace App\Http\Controllers\Botanic\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Genres;
|
||||
use App\Repositories\Shop\Families;
|
||||
use App\Repositories\Botanic\Genres;
|
||||
use App\Repositories\Botanic\Families;
|
||||
use App\DataTables\GenresDataTable;
|
||||
|
||||
class GenreController extends Controller
|
||||
{
|
||||
public function index(GenresDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Shop.Admin.Genres.list');
|
||||
return $dataTable->render('Botanic.Admin.Genres.list');
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
@@ -23,26 +23,26 @@ class GenreController extends Controller
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('Shop.Admin.Genres.create');
|
||||
return view('Botanic.Admin.Genres.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Genres::store($request);
|
||||
return redirect()->route('Shop.Admin.Genres.index');
|
||||
return redirect()->route('Botanic.Admin.Genres.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = Genres::get($id);
|
||||
return view('Shop.Admin.Genres.view', $data);
|
||||
return view('Botanic.Admin.Genres.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Genres::get($id);
|
||||
$data['families'] = Families::getOptions();
|
||||
return view('Shop.Admin.Genres.edit', $data);
|
||||
return view('Botanic.Admin.Genres.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
@@ -1,19 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
namespace App\Http\Controllers\Botanic\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Species;
|
||||
use App\Repositories\Shop\Genres;
|
||||
use App\Repositories\Botanic\Species;
|
||||
use App\Repositories\Botanic\Genres;
|
||||
use App\DataTables\SpeciesDataTable;
|
||||
|
||||
class SpecieController extends Controller
|
||||
{
|
||||
public function index(SpeciesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Shop.Admin.Species.list');
|
||||
return $dataTable->render('Botanic.Admin.Species.list');
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
@@ -23,26 +23,26 @@ class SpecieController extends Controller
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('Shop.Admin.Species.create');
|
||||
return view('Botanic.Admin.Species.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Species::store($request);
|
||||
return redirect()->route('Shop.Admin.Species.index');
|
||||
return redirect()->route('Botanic.Admin.Species.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = Species::get($id);
|
||||
return view('Shop.Admin.Species.view', $data);
|
||||
return view('Botanic.Admin.Species.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Species::get($id);
|
||||
$data['genres'] = Genres::getOptions();
|
||||
return view('Shop.Admin.Species.edit', $data);
|
||||
return view('Botanic.Admin.Species.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
@@ -1,19 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
namespace App\Http\Controllers\Botanic\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Varieties;
|
||||
use App\Repositories\Shop\Species;
|
||||
use App\Repositories\Botanic\Varieties;
|
||||
use App\Repositories\Botanic\Species;
|
||||
use App\DataTables\VarietiesDataTable;
|
||||
|
||||
class VarietyController extends Controller
|
||||
{
|
||||
public function index(VarietiesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Shop.Admin.Varieties.list');
|
||||
return $dataTable->render('Botanic.Admin.Varieties.list');
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
@@ -23,26 +23,26 @@ class VarietyController extends Controller
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('Shop.Admin.Varieties.create');
|
||||
return view('Botanic.Admin.Varieties.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Varieties::store($request);
|
||||
return redirect()->route('Shop.Admin.Varieties.index');
|
||||
return redirect()->route('Botanic.Admin.Varieties.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = Varieties::get($id);
|
||||
return view('Shop.Admin.Varieties.view', $data);
|
||||
return view('Botanic.Admin.Varieties.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Varieties::get($id);
|
||||
$data['species'] = Species::getOptions();
|
||||
return view('Shop.Admin.Varieties.edit', $data);
|
||||
return view('Botanic.Admin.Varieties.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use App\ProductAttribute;
|
||||
use App\Model\Shop\ArticleAttribute;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class ProductAttributeController extends Controller
|
||||
class ArticleAttributeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
@@ -42,10 +42,10 @@ class ProductAttributeController extends Controller
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\ProductAttribute $productAttribute
|
||||
* @param \App\ArticleAttribute $ArticleAttribute
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(ProductAttribute $productAttribute)
|
||||
public function show(ArticleAttribute $ArticleAttribute)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -53,10 +53,10 @@ class ProductAttributeController extends Controller
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\ProductAttribute $productAttribute
|
||||
* @param \App\ArticleAttribute $ArticleAttribute
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(ProductAttribute $productAttribute)
|
||||
public function edit(ArticleAttribute $ArticleAttribute)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -65,10 +65,10 @@ class ProductAttributeController extends Controller
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\ProductAttribute $productAttribute
|
||||
* @param \App\ArticleAttribute $ArticleAttribute
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, ProductAttribute $productAttribute)
|
||||
public function update(Request $request, ArticleAttribute $ArticleAttribute)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -76,10 +76,10 @@ class ProductAttributeController extends Controller
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\ProductAttribute $productAttribute
|
||||
* @param \App\ArticleAttribute $ArticleAttribute
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(ProductAttribute $productAttribute)
|
||||
public function destroy(ArticleAttribute $ArticleAttribute)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use App\Product;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class ProductController extends Controller
|
||||
use App\Models\Shop\Article;
|
||||
use App\Repositories\Shop\Articles;
|
||||
|
||||
class ArticleController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
@@ -42,10 +44,10 @@ class ProductController extends Controller
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Product $product
|
||||
* @param \App\Article $Article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Product $product)
|
||||
public function show(Article $Article)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -53,10 +55,10 @@ class ProductController extends Controller
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Product $product
|
||||
* @param \App\Article $Article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Product $product)
|
||||
public function edit(Article $Article)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -65,10 +67,10 @@ class ProductController extends Controller
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Product $product
|
||||
* @param \App\Article $Article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Product $product)
|
||||
public function update(Request $request, Article $Article)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -76,10 +78,10 @@ class ProductController extends Controller
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Product $product
|
||||
* @param \App\Article $Article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Product $product)
|
||||
public function destroy(Article $Article)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use App\ProductPrice;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class ProductPriceController extends Controller
|
||||
use App\Models\Shop\ArticlePrice;
|
||||
use App\Repositories\Shop\ArticlePrices;
|
||||
|
||||
class ArticlePriceController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
@@ -42,10 +44,10 @@ class ProductPriceController extends Controller
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\ProductPrice $productPrice
|
||||
* @param \App\ArticlePrice $ArticlePrice
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(ProductPrice $productPrice)
|
||||
public function show(ArticlePrice $ArticlePrice)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -53,10 +55,10 @@ class ProductPriceController extends Controller
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\ProductPrice $productPrice
|
||||
* @param \App\ArticlePrice $ArticlePrice
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(ProductPrice $productPrice)
|
||||
public function edit(ArticlePrice $ArticlePrice)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -65,10 +67,10 @@ class ProductPriceController extends Controller
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\ProductPrice $productPrice
|
||||
* @param \App\ArticlePrice $ArticlePrice
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, ProductPrice $productPrice)
|
||||
public function update(Request $request, ArticlePrice $ArticlePrice)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -76,10 +78,10 @@ class ProductPriceController extends Controller
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\ProductPrice $productPrice
|
||||
* @param \App\ArticlePrice $ArticlePrice
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(ProductPrice $productPrice)
|
||||
public function destroy(ArticlePrice $ArticlePrice)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -5,28 +5,20 @@ namespace App\Http\Controllers\Shop\Admin;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Sections;
|
||||
use App\Repositories\Shop\Categories;
|
||||
use App\DataTables\CategoriesDataTable;
|
||||
|
||||
class SectionController extends Controller
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
|
||||
public function index(CategoriesDataTable $dataTable)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
return self::getDatatable($request);
|
||||
} else {
|
||||
$data = [];
|
||||
return view('Shop.Admin.Sections.list', $data);
|
||||
}
|
||||
}
|
||||
return $dataTable->render('Shop.Admin.Categories.list');
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
{
|
||||
return Sections::getTables($request->all());
|
||||
return Categories::getTables($request->all());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,7 +29,7 @@ class SectionController extends Controller
|
||||
public function create()
|
||||
{
|
||||
$data = [];
|
||||
return view('Shop.Admin.Sections.create', $data);
|
||||
return view('Shop.Admin.Categories.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,8 +40,8 @@ class SectionController extends Controller
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Sections::store($request);
|
||||
return redirect()->route('Shop.Admin.Sections.index');
|
||||
$ret = Categories::store($request);
|
||||
return redirect()->route('Shop.Admin.Categories.index');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,8 +52,8 @@ class SectionController extends Controller
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$data = Sections::get($id);
|
||||
return view('Shop.Admin.Sections.view', $data);
|
||||
$data = Categories::get($id);
|
||||
return view('Shop.Admin.Categories.view', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,8 +64,8 @@ class SectionController extends Controller
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Sections::get($id);
|
||||
return view('Shop.Admin.Sections.edit', $data);
|
||||
$data = Categories::get($id);
|
||||
return view('Shop.Admin.Categories.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,6 +88,6 @@ class SectionController extends Controller
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
return Sections::destroy($id);
|
||||
return Categories::destroy($id);
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,9 @@ namespace App\Http\Controllers\Shop;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Products;
|
||||
use App\Repositories\Shop\Articles;
|
||||
|
||||
class ProductController extends Controller
|
||||
class ArticleController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
@@ -43,10 +43,10 @@ class ProductController extends Controller
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Product $product
|
||||
* @param \App\Article $article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Product $product)
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -54,10 +54,10 @@ class ProductController extends Controller
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Product $product
|
||||
* @param \App\Article $article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Product $product)
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -66,10 +66,10 @@ class ProductController extends Controller
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Product $product
|
||||
* @param \App\Article $article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Product $product)
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -77,10 +77,10 @@ class ProductController extends Controller
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Product $product
|
||||
* @param \App\Article $article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Product $product)
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -5,9 +5,9 @@ namespace App\Http\Controllers\Shop;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Sections;
|
||||
use App\Repositories\Shop\Categorys;
|
||||
|
||||
class SectionController extends Controller
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
@@ -20,13 +20,13 @@ class SectionController extends Controller
|
||||
return self::getDatatable($request);
|
||||
} else {
|
||||
$data = [];
|
||||
return view('Shop.Sections.list', $data);
|
||||
return view('Shop.Categories.list', $data);
|
||||
}
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
{
|
||||
return Sections::getTables($request->all());
|
||||
return Categories::getDatatable($request->all());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,10 +35,10 @@ class SectionController extends Controller
|
||||
* @param \App\Customer $customer
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Customer $customer)
|
||||
public function show($id)
|
||||
{
|
||||
$data = Sections::get($id);
|
||||
return view('Shop.Admin.Sections.view', $data);
|
||||
$data = Categories::get($id);
|
||||
return view('Shop.Admin.Categories.view', $data);
|
||||
}
|
||||
|
||||
}
|
||||
27
app/Menu/Botanic.php
Normal file
27
app/Menu/Botanic.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Menu;
|
||||
|
||||
use Sebastienheyd\Boilerplate\Menu\Builder;
|
||||
use App\Repositories\Users;
|
||||
|
||||
class Botanic
|
||||
{
|
||||
public function make(Builder $menu)
|
||||
{
|
||||
$menu->add('Botanique', [ 'permission' => 'backend', 'icon' => 'envira' ])
|
||||
->id('botanic')
|
||||
->activeIfRoute('botanic')
|
||||
->order(2);
|
||||
|
||||
$menu->addTo('Botanic', 'Familles', [ 'route' => 'Botanic.Admin.Families.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Botanic.Admin.Families.index'])->order(1);
|
||||
$menu->addTo('Botanic', 'Genres', [ 'route' => 'Botanic.Admin.Genres.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Botanic.Admin.Genres.index'])->order(2);
|
||||
$menu->addTo('Botanic', 'Espèces', [ 'route' => 'Botanic.Admin.Species.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Botanic.Admin.Species.index'])->order(3);
|
||||
$menu->addTo('Botanic', 'Variétés', [ 'route' => 'Botanic.Admin.Varieties.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Botanic.Admin.Varieties.index'])->order(4);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,15 +14,6 @@ class Shop
|
||||
->activeIfRoute('shop')
|
||||
->order(1);
|
||||
|
||||
$menu->addTo('shop', 'Familles', [ 'route' => 'Shop.Admin.Families.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Shop.Admin.Families.index'])->order(1);
|
||||
$menu->addTo('shop', 'Genres', [ 'route' => 'Shop.Admin.Genres.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Shop.Admin.Genres.index'])->order(2);
|
||||
$menu->addTo('shop', 'Espèces', [ 'route' => 'Shop.Admin.Species.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Shop.Admin.Species.index'])->order(3);
|
||||
$menu->addTo('shop', 'Variétés', [ 'route' => 'Shop.Admin.Varieties.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Shop.Admin.Varieties.index'])->order(4);
|
||||
|
||||
$menu->addTo('shop', 'Categories', [ 'route' => 'Shop.Admin.Sections.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Shop.Admin.Sections.index'])->order(5);
|
||||
$menu->addTo('shop', 'Produits', [ 'route' => 'Shop.Admin.Products.index', 'permission' => 'backend' ])
|
||||
@@ -32,7 +23,5 @@ class Shop
|
||||
$menu->addTo('shop', 'Factures', [ 'route' => 'Shop.Admin.Invoices.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Shop.Admin.Invoices.index'])->order(8);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
namespace App\Models\Botanic;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Family extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_product_families';
|
||||
protected $table = 'botanic_families';
|
||||
|
||||
public function genres()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Genre');
|
||||
return $this->hasMany('App\Models\Botanic\Genre');
|
||||
}
|
||||
|
||||
public function scopeByName($query,$name)
|
||||
@@ -1,22 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
namespace App\Models\Botanic;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Genre extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_product_genres';
|
||||
protected $table = 'botanic_genres';
|
||||
|
||||
public function family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Family');
|
||||
return $this->belongsTo('App\Models\Botanic\Family');
|
||||
}
|
||||
|
||||
public function species()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Specie');
|
||||
return $this->hasMany('App\Models\Botanic\Specie');
|
||||
}
|
||||
|
||||
public function scopeByName($query,$name)
|
||||
@@ -1,22 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
namespace App\Models\Botanic;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Specie extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_product_species';
|
||||
protected $table = 'botanic_species';
|
||||
|
||||
public function Genre()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Family');
|
||||
return $this->belongsTo('App\Models\Botanic\Family');
|
||||
}
|
||||
|
||||
public function Varieties()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Variety');
|
||||
return $this->hasMany('App\Models\Botanic\Variety');
|
||||
}
|
||||
|
||||
public function scopeByName($query,$name)
|
||||
@@ -1,16 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
namespace App\Models\Botanic;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Variety extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_product_varieties';
|
||||
protected $table = 'botanic_varieties';
|
||||
|
||||
public function Specie()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Specie');
|
||||
return $this->belongsTo('App\Models\Botanic\Specie');
|
||||
}
|
||||
}
|
||||
@@ -4,45 +4,34 @@ namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use Rinvex\Categories\Traits\Categorizable;
|
||||
|
||||
class Product extends Model
|
||||
{
|
||||
use Categorizable;
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_products';
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function Inventories()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Inventory');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function Prices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\ProductPrice');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function ProductAttributes()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\ProductAttribute');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function Categories()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\CategoryProduct');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function InvoiceItems()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\InvoiceItem');
|
||||
|
||||
@@ -6,8 +6,9 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProductSection extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_product_sections';
|
||||
|
||||
public function Product()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Product');
|
||||
|
||||
@@ -4,12 +4,17 @@ namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use Rinvex\Categories\Traits\Categorizable,
|
||||
use Rinvex\Categories\Traits\Categorizable;
|
||||
|
||||
class Section extends Model
|
||||
{
|
||||
use Categorizable;
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_sections';
|
||||
|
||||
public function Category()
|
||||
{
|
||||
return $this->hasMany('App\Models\Category');
|
||||
}
|
||||
|
||||
public function Products()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
namespace App\Repositories\Botanic;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -8,7 +8,7 @@ use Illuminate\Support\Str;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\Family;
|
||||
use App\Models\Botanic\Family;
|
||||
|
||||
class Families
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
namespace App\Repositories\Botanic;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -8,7 +8,7 @@ use Illuminate\Support\Str;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\Genre;
|
||||
use App\Models\Botanic\Genre;
|
||||
|
||||
class Genres
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
namespace App\Repositories\Botanic;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -8,7 +8,7 @@ use Illuminate\Support\Str;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\Specie;
|
||||
use App\Models\Botanic\Specie;
|
||||
|
||||
class Species
|
||||
{
|
||||
@@ -8,25 +8,25 @@ use Illuminate\Support\Str;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\Product;
|
||||
use App\Models\Shop\Article;
|
||||
|
||||
class Products
|
||||
class Articles
|
||||
{
|
||||
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = Product::orderBy('name');
|
||||
$model = Article::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return Product::orderBy('name','asc')->get();
|
||||
return Article::orderBy('name','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return Product::find($id);
|
||||
return Article::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
@@ -38,17 +38,17 @@ class Products
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return Product::create($data);
|
||||
return Article::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
return Product::find($id)->update($data);
|
||||
return Article::find($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Product::destroy($id);
|
||||
return Article::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
56
app/Repositories/Shop/Categories.php
Normal file
56
app/Repositories/Shop/Categories.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\Categorie;
|
||||
|
||||
class Categories
|
||||
{
|
||||
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = Categorie::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return Categorie::orderBy('name','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return Categorie::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
app('rinvex.categories.category')->create(['name' => $data['name']]);
|
||||
return Categorie::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
app('rinvex.categories.category')->update(['name' => $data['name']]);
|
||||
return Categorie::find($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Categorie::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user