diff --git a/app/Http/Controllers/Admin/TagController.php b/app/Http/Controllers/Admin/TagController.php new file mode 100644 index 0000000..5ee7fd5 --- /dev/null +++ b/app/Http/Controllers/Admin/TagController.php @@ -0,0 +1,71 @@ +has('sort') || !in_array(\request('sort'), $this->cols)) { + $query = $this->_MODEL_::orderByDesc('id'); + } else { + $query = $this->_MODEL_::orderBy(\request('sort'), \request('sortType', 'asc')); + } + + foreach (\request()->input('filter', []) as $col => $filter) { + if (isJson($filter)) { + $vals = json_decode($filter); + if (count($vals) != 0) { + $query->whereIn($col, $vals); + } + } else { + $query->where($col, $filter); + } + } + + if (mb_strlen(trim(\request()->input('q', ''))) > 0) { + $q = trim(json_encode(\request()->input('q', '')), ' "'); + $q = str_replace('\\', '\\\\', $q); + foreach ($this->searchable as $col) { + $query->where(function ($query) use ($q) { + foreach ($this->searchable as $key => $col) { + if ($key === 0) { + $query->where($col, 'LIKE', '%' . $q . '%'); + } else { + $query->orWhere($col, 'LIKE', '%' . $q . '%'); + } + } + }); + } + } + return $query; + } + +} diff --git a/app/Http/Controllers/Admin/XLangController.php b/app/Http/Controllers/Admin/XLangController.php index af04a9a..1dadc25 100644 --- a/app/Http/Controllers/Admin/XLangController.php +++ b/app/Http/Controllers/Admin/XLangController.php @@ -28,6 +28,7 @@ use Illuminate\Http\Request; use App\Helper; use Illuminate\Support\Facades\Artisan; use Spatie\Image\Image as SpatieImage; +use Spatie\Tags\Tag; use function App\Helpers\hasCreateRoute; @@ -53,6 +54,7 @@ class XLangController extends XController State::class, City::class, Transport::class, + Tag::class, ]; diff --git a/app/Http/Requests/TagSaveRequest.php b/app/Http/Requests/TagSaveRequest.php new file mode 100644 index 0000000..6630fd8 --- /dev/null +++ b/app/Http/Requests/TagSaveRequest.php @@ -0,0 +1,28 @@ +|string> + */ + public function rules(): array + { + return [ + // + ]; + } +} diff --git a/resources/views/admin/tags/tag-list.blade.php b/resources/views/admin/tags/tag-list.blade.php new file mode 100644 index 0000000..fa1e520 --- /dev/null +++ b/resources/views/admin/tags/tag-list.blade.php @@ -0,0 +1,15 @@ +@extends('admin.templates.panel-list-template') + +@section('list-title') + + {{__("Tags list")}} +@endsection +@section('title') + {{__("Tags list")}} - +@endsection +@section('filter') + {{-- Other filters --}} +@endsection +@section('bulk') + {{-- --}} +@endsection diff --git a/resources/views/components/panel-side-navbar.blade.php b/resources/views/components/panel-side-navbar.blade.php index e0e4d59..add1b9a 100644 --- a/resources/views/components/panel-side-navbar.blade.php +++ b/resources/views/components/panel-side-navbar.blade.php @@ -140,6 +140,14 @@ @endif + @if( auth()->user()->hasAnyAccess( 'tags' )) +
  • + + + {{__("Attachments")}} + +
  • + @endif @endif diff --git a/routes/web.php b/routes/web.php index 2b92f3c..8b1e9d2 100644 --- a/routes/web.php +++ b/routes/web.php @@ -66,6 +66,10 @@ Route::prefix(config('app.panel.prefix'))->name('admin.')->group( Route::post('bulk', [\App\Http\Controllers\Admin\DiscountController::class, "bulk"])->name('bulk'); Route::get('trashed', [\App\Http\Controllers\Admin\DiscountController::class, "trashed"])->name('trashed'); }); + Route::prefix('tags')->name('tag.')->group( + function () { + Route::get('', [\App\Http\Controllers\Admin\TagController::class, 'index'])->name('index'); + }); Route::prefix('tickets')->name('ticket.')->group( function () { Route::get('', [\App\Http\Controllers\Admin\TicketController::class, 'index'])->name('index');