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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user