Upgrade package category and dependencies for php8.0
This commit is contained in:
@@ -12,7 +12,7 @@ class CategoriesDataTable extends DataTable
|
||||
|
||||
public function query(Category $model)
|
||||
{
|
||||
$model = $model::with(['tags.articles'])->withCount(['articles','tags']);
|
||||
$model = $model::with(['tags.articles'])->withCount(['articles', 'tags']);
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,26 +3,28 @@
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
// use Rinvex\Categories\Traits\Categorizable;
|
||||
use Cesargb\Database\Support\CascadeDelete;
|
||||
use Rinvex\Tags\Traits\Taggable;
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
|
||||
use Kalnoy\Nestedset\NodeTrait;
|
||||
// use Kalnoy\Nestedset\NodeTrait;
|
||||
|
||||
class Category extends Model
|
||||
use Rinvex\Categories\Models\Category as parentCategory;
|
||||
|
||||
class Category extends parentCategory
|
||||
{
|
||||
use HasTranslations, InteractsWithMedia, NodeTrait, SoftDeletes, Taggable, Userstamps;
|
||||
use CascadeDelete, Taggable, Userstamps;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'categories';
|
||||
public $translatable = ['name','description'];
|
||||
public $translatable = ['name', 'description'];
|
||||
protected $cascadeDeleteMorph = ['Articles'];
|
||||
|
||||
public function Articles()
|
||||
{
|
||||
|
||||
@@ -121,10 +121,7 @@ class Categories
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
$node = CategoryTrees::create($data);
|
||||
$data['category_id'] = $node->id;
|
||||
$category = Category::create($data);
|
||||
return $category;
|
||||
return Category::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
@@ -132,14 +129,14 @@ class Categories
|
||||
$id = $id ? $id : $data['id'];
|
||||
$category = self::get($id);
|
||||
$ret = $category->update($data);
|
||||
CategoryTrees::update($data, $category->category_id);
|
||||
// CategoryTrees::update($data, $category->category_id);
|
||||
return $category;
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
$category = self::get($id);
|
||||
CategoryTrees::destroy($category->category_id);
|
||||
// $category = self::get($id);
|
||||
// CategoryTrees::destroy($category->category_id);
|
||||
return Category::destroy($id);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
"intervention/imagecache": "^2.4",
|
||||
"jasonlewis/expressive-date": "^1.0",
|
||||
"jenssegers/date": "^4.0",
|
||||
"kalnoy/nestedset": "^5.0",
|
||||
"kalnoy/nestedset": "^6.0",
|
||||
"kirschbaum-development/eloquent-power-joins": "^2.3",
|
||||
"kmlaravel/laravel-geographical-calculator": "^2.1",
|
||||
"knplabs/knp-snappy": "^1.2",
|
||||
@@ -68,14 +68,14 @@
|
||||
"proengsoft/laravel-jsvalidation": "^4.5",
|
||||
"qoraiche/laravel-mail-editor": "^3.2",
|
||||
"respect/validation": "^2.2",
|
||||
"rinvex/laravel-categories": "^5.0",
|
||||
"rinvex/laravel-tags": "^5.0",
|
||||
"rinvex/laravel-categories": "^6.0",
|
||||
"rinvex/laravel-tags": "^6.0",
|
||||
"rutorika/sortable": "^8.0",
|
||||
"santigarcor/laratrust": "^6.0",
|
||||
"sebastienheyd/boilerplate": "^7.5",
|
||||
"smajohusic/laravel-mail-logger": "^1.0",
|
||||
"softcreatr/php-mime-detector": "^3.2",
|
||||
"spatie/eloquent-sortable": "^3.11",
|
||||
"spatie/eloquent-sortable": "^4.0",
|
||||
"spatie/image-optimizer": "^1.4",
|
||||
"spatie/laravel-activitylog": "^3.6",
|
||||
"spatie/laravel-backup": "^6.16",
|
||||
|
||||
@@ -7,7 +7,14 @@
|
||||
</div>
|
||||
<div class="col-5">
|
||||
{{ Form::label('parent', 'Rubrique parente') }}
|
||||
@include('components.form.select', ['name' => 'parent_id', 'list' => $categories ?? [], 'value' => $category['category_tree']['parent_id'] ?? null, 'required' => true, 'with_empty' => ''])
|
||||
@include('components.form.select', [
|
||||
'name' => 'parent_id',
|
||||
'list' => $categories ?? [],
|
||||
'value' => $category['parent_id'] ?? null,
|
||||
'required' => true,
|
||||
'with_empty' => '',
|
||||
'class' => 'select2',
|
||||
])
|
||||
</div>
|
||||
<div class="col-1 text-right">
|
||||
{{ Form::label('visible', 'Visible') }}<br/>
|
||||
@@ -17,7 +24,13 @@
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
{{ Form::label('tags', 'Tags') }}
|
||||
@include('components.form.selects.select-tree', ['name' => 'tags[]', 'list' => $tags_list, 'values' => $category['tags'] ?? null, 'class' => 'select2', 'multiple' => true])
|
||||
@include('components.form.selects.select-tree', [
|
||||
'name' => 'tags[]',
|
||||
'list' => $tags_list,
|
||||
'values' => $category['tags'] ?? null,
|
||||
'class' => 'select2',
|
||||
'multiple' => true,
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
@@ -28,10 +41,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<!--
|
||||
{{ Form::label('photo', 'Photos') }}
|
||||
@include('components.uploader.widget', ['load_url' => route('Admin.Shop.Categories.getImages', ['id' => $category['id'] ?? false]), 'delete_url' => route('Admin.Shop.Categories.deleteImage') ])
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
@component('components.card')
|
||||
@include('components.datatable', ['route' => route('Admin.Shop.Categories.index'), 'model' => 'categories', 'callback' => 'handleCategory();'])
|
||||
@include('components.datatable', [
|
||||
'route' => route('Admin.Shop.Categories.index'),
|
||||
'model' => 'categories',
|
||||
'callback' => 'handleCategory();'
|
||||
])
|
||||
@endcomponent
|
||||
</div>
|
||||
<div class="col-4">
|
||||
@@ -24,6 +28,7 @@
|
||||
<script>
|
||||
function handleCategory() {
|
||||
initToggle("{{ route('Admin.Shop.Categories.toggleVisible') }}");
|
||||
$('#tree1').tree('reload');
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
Reference in New Issue
Block a user