¨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

@@ -20,6 +20,7 @@ class CreateTagsTable extends Migration
});
}
/**
* Reverse the migrations.
*

View File

@@ -24,6 +24,7 @@ class CreateTagTranslationsTable extends Migration
});
}
/**
* Reverse the migrations.
*

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()
{

View File

@@ -3,6 +3,7 @@
namespace Modules\Tag\Http\Controllers;
use Modules\Tag\Entities\Tag;
use Illuminate\Http\Response;
use Modules\Product\Entities\Product;
use Modules\Product\Filters\ProductFilter;
use Modules\Product\Http\Controllers\ProductSearch;
@@ -14,7 +15,7 @@ class TagProductController
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function index($slug, Product $model, ProductFilter $productFilter)
{

View File

@@ -13,6 +13,7 @@ class SaveTagRequest extends Request
*/
protected $availableAttributes = 'tag::attributes';
/**
* Get the validation rules that apply to the request.
*

View File

@@ -3,14 +3,11 @@
namespace Modules\Tag\Providers;
use Modules\Tag\Table\TagTabs;
use Modules\Support\Traits\AddsAsset;
use Illuminate\Support\ServiceProvider;
use Modules\Admin\Ui\Facades\TabManager;
class TagServiceProvider extends ServiceProvider
{
use AddsAsset;
/**
* Bootstrap the application services.
*

View File

@@ -25,7 +25,7 @@
@endcomponent
@push('scripts')
<script>
<script type="module">
new DataTable('#tags-table .table', {
columns: [
{ data: 'checkbox', orderable: false, searchable: false, width: '3%' },

View File

@@ -6,7 +6,7 @@
@endpush
@push('scripts')
<script>
<script type="module">
keypressAction([
{ key: 'b', route: "{{ route('admin.tags.index') }}" }
]);

View File

@@ -38,5 +38,11 @@ Route::delete('tags/{ids?}', [
'middleware' => 'can:admin.tags.destroy',
]);
// append
Route::get('tags/index/table', [
'as' => 'admin.tags.table',
'uses' => 'TagController@table',
'middleware' => 'can:admin.tags.index',
]);

View File

@@ -15,7 +15,7 @@ class SidebarExtender extends BaseSidebarExtender
$group->item(trans('product::sidebar.products'), function (Item $item) {
$item->item(trans('tag::tags.tags'), function (Item $item) {
$item->icon('fa fa-tag');
$item->weight(27);
$item->weight(35);
$item->route('admin.tags.index');
$item->authorize(
$this->auth->hasAccess('admin.tags.index')

View File

@@ -14,6 +14,7 @@ class TagTabs extends Tabs
->add($this->general());
}
private function general()
{
return tap(new Tab('general', trans('tag::tags.tabs.general')), function (Tab $tab) {