Tags
This commit is contained in:
30
app/DataTables/Shop/TagFamiliesDataTable.php
Normal file
30
app/DataTables/Shop/TagFamiliesDataTable.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\TagFamily;
|
||||
|
||||
class TagFamiliesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'TagFamilies';
|
||||
|
||||
public function query(TagFamily $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(120)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
30
app/DataTables/Shop/TagsDataTable.php
Normal file
30
app/DataTables/Shop/TagsDataTable.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Tag;
|
||||
|
||||
class TagsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Tags';
|
||||
|
||||
public function query(Tag $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(120)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
63
app/Http/Controllers/Shop/Admin/TagController.php
Normal file
63
app/Http/Controllers/Shop/Admin/TagController.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Tags;
|
||||
use App\Repositories\Shop\TagFamilies;
|
||||
use App\DataTables\Shop\TagsDataTable;
|
||||
|
||||
class TagController extends Controller
|
||||
{
|
||||
public function index(TagsDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Shop.Admin.Tags.list');
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
{
|
||||
return Tags::getTables($request->all());
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = [];
|
||||
$data['categories'] = Categories::getOptions();
|
||||
$data['families'] = TagFamilies::getOptions();
|
||||
$data['attribute_families'] = TagAttributeFamilies::getOptions();
|
||||
$data['models'] = ['App\Models\Botanic\Specie' => 'Espèces', 'App\Models\Botanic\Variety' => 'Variétés'];
|
||||
return view('Shop.Admin.Tags.create', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Tags::store($request->all());
|
||||
return redirect()->route('Shop.Admin.Tags.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = Tags::get($id);
|
||||
return view('Shop.Admin.Tags.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Tags::get($id);
|
||||
$data['categories'] = Tags::getOptions();
|
||||
return view('Shop.Admin.Tags.edit', $data);
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return Tags::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
62
app/Http/Controllers/Shop/Admin/TagFamilyController.php
Normal file
62
app/Http/Controllers/Shop/Admin/TagFamilyController.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\TagFamily;
|
||||
use App\DataTables\Shop\TagFamiliesDataTable;
|
||||
|
||||
class TagFamilyController extends Controller
|
||||
{
|
||||
public function index(TagFamiliesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Shop.Admin.TagFamilies.list');
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
{
|
||||
return TagFamilies::getTables($request->all());
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = [];
|
||||
$data['categories'] = Categories::getOptions();
|
||||
$data['families'] = TagFamilyFamilies::getOptions();
|
||||
$data['attribute_families'] = TagFamilyAttributeFamilies::getOptions();
|
||||
$data['models'] = ['App\Models\Botanic\Specie' => 'Espèces', 'App\Models\Botanic\Variety' => 'Variétés'];
|
||||
return view('Shop.Admin.TagFamilies.create', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = TagFamilies::store($request->all());
|
||||
return redirect()->route('Shop.Admin.TagFamilies.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = TagFamilies::get($id);
|
||||
return view('Shop.Admin.TagFamilies.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = TagFamilies::get($id);
|
||||
$data['categories'] = TagFamilies::getOptions();
|
||||
return view('Shop.Admin.TagFamilies.edit', $data);
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return TagFamilies::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,10 +23,16 @@ class Shop
|
||||
->activeIfRoute(['Shop.Admin.ArticleAttributeFamilies.*'])->order(4);
|
||||
$menu->addTo('shop', 'Attributs', [ 'route' => 'Shop.Admin.ArticleAttributeValues.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.ArticleAttributeValues.*'])->order(5);
|
||||
$menu->addTo('shop', 'Familles de tags', [ 'route' => 'Shop.Admin.TagFamilies.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.TagFamilies.*'])->order(6);
|
||||
$menu->addTo('shop', 'Tags', [ 'route' => 'Shop.Admin.Tags.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.Tags.*'])->order(7);
|
||||
|
||||
|
||||
$menu->addTo('shop', 'Réductions', [ 'route' => 'Shop.Admin.ArticleAttributeValues.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.ArticleAttributeValues.*'])->order(6);
|
||||
->activeIfRoute(['Shop.Admin.ArticleAttributeValues.*'])->order(8);
|
||||
$menu->addTo('shop', 'Stock', [ 'route' => 'Shop.Admin.ArticleAttributeValues.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.ArticleAttributeValues.*'])->order(7);
|
||||
->activeIfRoute(['Shop.Admin.ArticleAttributeValues.*'])->order(9);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,8 +4,9 @@ namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TagGroup extends Model
|
||||
class TagFamily extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'tagging_tag_groups';
|
||||
|
||||
}
|
||||
12
app/Models/Shop/TagFamily.php
Normal file
12
app/Models/Shop/TagFamily.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TagFamily extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'tagging_tag_groups';
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user