¨4.0.1¨

This commit is contained in:
¨NW¨
2023-12-03 14:07:47 +00:00
parent c08b36d1b6
commit f35052522d
1112 changed files with 43019 additions and 24987 deletions

View File

@@ -3,37 +3,37 @@
namespace Modules\Tag\Entities;
use Modules\Admin\Ui\AdminTable;
use Illuminate\Http\JsonResponse;
use Modules\Support\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
use Modules\Product\Entities\Product;
use Modules\Support\Eloquent\Sluggable;
use Modules\Support\Eloquent\Translatable;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Tag extends Model
{
use Translatable, Sluggable;
/**
* The relations to eager load on every query.
*
* @var array
*/
protected $with = ['translations'];
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that are translatable.
*
* @var array
*/
public $translatedAttributes = ['name'];
/**
* The relations to eager load on every query.
*
* @var array
*/
protected $with = ['translations'];
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attribute that will be slugged.
*
@@ -41,10 +41,11 @@ class Tag extends Model
*/
protected $slugAttribute = 'name';
/**
* Get tag list.
*
* @return \Illuminate\Database\Eloquent\Collection
* @return Collection
*/
public static function list()
{
@@ -53,10 +54,12 @@ class Tag extends Model
});
}
/**
* Find a tag by the given slug.
*
* @param string $slug
*
* @return self
*/
public static function findBySlug($slug)
@@ -64,6 +67,7 @@ class Tag extends Model
return self::where('slug', $slug)->firstOrNew([]);
}
/**
* Get public url for tag products.
*
@@ -74,20 +78,22 @@ class Tag extends Model
return route('tags.products.index', ['tag' => $this->slug]);
}
/**
* Get related products.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
* @return BelongsToMany
*/
public function products()
{
return $this->belongsToMany(Product::class, 'product_tags');
}
/**
* Get table data for the resource
*
* @return \Illuminate\Http\JsonResponse
* @return JsonResponse
*/
public function table()
{