Файловый менеджер - Редактировать - /home/c7lekhnath/silverray.com.au/Modules/Language/database/seeders/68334/Testimonial.tar
Назад
lang/.gitkeep 0000644 00000000000 15012231570 0007100 0 ustar 00 module.json 0000644 00000000356 15012231570 0006724 0 ustar 00 { "name": "Testimonial", "alias": "testimonial", "description": "", "keywords": [], "priority": 0, "providers": [ "Modules\\Testimonial\\app\\Providers\\TestimonialServiceProvider" ], "files": [] } tests/Unit/.gitkeep 0000644 00000000000 15012231571 0010241 0 ustar 00 tests/Feature/.gitkeep 0000644 00000000000 15012231571 0010715 0 ustar 00 vite.config.js 0000644 00000001314 15012231571 0007311 0 ustar 00 import { defineConfig } from 'vite'; import laravel from 'laravel-vite-plugin'; export default defineConfig({ build: { outDir: '../../public/build-testimonial', emptyOutDir: true, manifest: true, }, plugins: [ laravel({ publicDirectory: '../../public', buildDirectory: 'build-testimonial', input: [ __dirname + '/resources/assets/sass/app.scss', __dirname + '/resources/assets/js/app.js' ], refresh: true, }), ], }); //export const paths = [ // 'Modules/$STUDLY_NAME$/resources/assets/sass/app.scss', // 'Modules/$STUDLY_NAME$/resources/assets/js/app.js', //]; wsus.json 0000644 00000000631 15012231571 0006435 0 ustar 00 { "name": "Testimonial Addon", "is_default": true, "description": "This is Testimonial Addon", "author": { "name": "Websolutionsus", "email": "websolutionus1@gmail.com", "website": "https://websolutionus.com" }, "license": "Proprietary", "url": "", "options" : { "route" : "home" }, "last_update": "2024-03-31", "version": "1.0.0" } routes/.gitkeep 0000644 00000000000 15012231571 0007501 0 ustar 00 routes/error_log 0000644 00000001120 15012231571 0007771 0 ustar 00 [13-May-2025 08:09:51 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Support\Facades\Route" not found in /home/lekhnath/silverray.com.au/Modules/Testimonial/routes/web.php:6 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/Testimonial/routes/web.php on line 6 [13-May-2025 16:56:20 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Support\Facades\Route" not found in /home/lekhnath/silverray.com.au/Modules/Testimonial/routes/api.php:5 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/Testimonial/routes/api.php on line 5 routes/web.php 0000644 00000000726 15012231571 0007355 0 ustar 00 <?php use Illuminate\Support\Facades\Route; use Modules\Testimonial\app\Http\Controllers\TestimonialController; Route::middleware(['auth:admin', 'translation']) ->name('admin.') ->prefix('admin') ->group(function () { Route::resource('testimonial', TestimonialController::class)->names('testimonial'); Route::put('/testimonial/status-update/{id}', [TestimonialController::class, 'statusUpdate'])->name('testimonial.status-update'); }); routes/api.php 0000644 00000000214 15012231571 0007341 0 ustar 00 <?php use Illuminate\Support\Facades\Route; Route::middleware(['auth:sanctum'])->prefix('v1')->name('api.')->group(function () { }); composer.json 0000644 00000001325 15012231571 0007264 0 ustar 00 { "name": "nwidart/testimonial", "description": "", "authors": [ { "name": "Nicolas Widart", "email": "n.widart@gmail.com" } ], "extra": { "laravel": { "providers": [], "aliases": { } } }, "autoload": { "psr-4": { "Modules\\Testimonial\\": "", "Modules\\Testimonial\\App\\": "app/", "Modules\\Testimonial\\Database\\Factories\\": "database/factories/", "Modules\\Testimonial\\Database\\Seeders\\": "database/seeders/" } }, "autoload-dev": { "psr-4": { "Modules\\Testimonial\\Tests\\": "tests/" } } } config/config.php 0000644 00000000060 15012231571 0007760 0 ustar 00 <?php return [ 'name' => 'Testimonial', ]; config/.gitkeep 0000644 00000000000 15012231571 0007425 0 ustar 00 package.json 0000644 00000000410 15012231571 0007022 0 ustar 00 { "private": true, "type": "module", "scripts": { "dev": "vite", "build": "vite build" }, "devDependencies": { "axios": "^1.1.2", "laravel-vite-plugin": "^0.7.5", "sass": "^1.69.5", "postcss": "^8.3.7", "vite": "^4.0.0" } } app/Http/Controllers/.gitkeep 0000644 00000000000 15012231571 0012165 0 ustar 00 app/Http/Controllers/TestimonialController.php 0000644 00000010462 15012231571 0015616 0 ustar 00 <?php namespace Modules\Testimonial\app\Http\Controllers; use App\Enums\RedirectType; use App\Http\Controllers\Controller; use App\Traits\RedirectHelperTrait; use Illuminate\Pagination\Paginator; use Illuminate\Support\Facades\File; use Modules\Language\app\Enums\TranslationModels; use Modules\Language\app\Models\Language; use Modules\Language\app\Traits\GenerateTranslationTrait; use Modules\Testimonial\app\Http\Requests\TestimonialRequest; use Modules\Testimonial\app\Models\Testimonial; class TestimonialController extends Controller { use GenerateTranslationTrait, RedirectHelperTrait; public function index() { checkAdminHasPermissionAndThrowException('testimonial.view'); Paginator::useBootstrap(); $testimonials = Testimonial::with('translation')->paginate(15); return view('testimonial::index', compact('testimonials')); } public function create() { checkAdminHasPermissionAndThrowException('testimonial.create'); return view('testimonial::create'); } public function store(TestimonialRequest $request) { checkAdminHasPermissionAndThrowException('testimonial.store'); $testimonial = Testimonial::create($request->validated()); if ($testimonial && $request->hasFile('image')) { $file_name = file_upload($request->image, 'uploads/custom-images/', $testimonial->image); $testimonial->image = $file_name; $testimonial->save(); } $languages = allLanguages(); $this->generateTranslations( TranslationModels::Testimonial, $testimonial, 'testimonial_id', $request, ); return $this->redirectWithMessage(RedirectType::CREATE->value, 'admin.testimonial.edit', ['testimonial' => $testimonial->id, 'code' => $languages->first()->code]); } public function show($id) { checkAdminHasPermissionAndThrowException('testimonial.view'); return view('testimonial::show'); } public function edit($id) { checkAdminHasPermissionAndThrowException('testimonial.edit'); $code = request('code') ?? getSessionLanguage(); abort_unless(Language::where('code', $code)->exists(), 404); $testimonial = Testimonial::findOrFail($id); $languages = allLanguages(); return view('testimonial::edit', compact('testimonial', 'code', 'languages')); } public function update(TestimonialRequest $request, $id) { checkAdminHasPermissionAndThrowException('testimonial.update'); $testimonial = Testimonial::findOrFail($id); $validatedData = $request->validated(); $testimonial->update($validatedData); if ($testimonial && $request->hasFile('image')) { $file_name = file_upload($request->image, 'uploads/custom-images/', $testimonial->image); $testimonial->image = $file_name; $testimonial->save(); } $this->updateTranslations( $testimonial, $request, $validatedData, ); return $this->redirectWithMessage(RedirectType::UPDATE->value, 'admin.testimonial.edit', ['testimonial' => $testimonial->id, 'code' => $request->code]); } public function destroy($id) { checkAdminHasPermissionAndThrowException('testimonial.delete'); $testimonial = Testimonial::findOrFail($id); $testimonial->translations()->each(function ($translation) { $translation->testimonial()->dissociate(); $translation->delete(); }); if ($testimonial->image) { if (File::exists(public_path($testimonial->image))) { @unlink(public_path($testimonial->image)); } } $testimonial->delete(); return $this->redirectWithMessage(RedirectType::DELETE->value, 'admin.testimonial.index'); } public function statusUpdate($id) { checkAdminHasPermissionAndThrowException('testimonial.update'); $testimonial = Testimonial::find($id); $status = $testimonial->status == 1 ? 0 : 1; $testimonial->update(['status' => $status]); $notification = __('Updated Successfully'); return response()->json([ 'success' => true, 'message' => $notification, ]); } } app/Http/Requests/.gitkeep 0000644 00000000000 15012231571 0011472 0 ustar 00 app/Http/Requests/TestimonialRequest.php 0000644 00000003423 15012231571 0014427 0 ustar 00 <?php namespace Modules\Testimonial\app\Http\Requests; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Support\Facades\Auth; class TestimonialRequest extends FormRequest { public function authorize(): bool { return (Auth::guard('admin')->check() && checkAdminHasPermission('testimonial.store')) ? true : false; } public function rules(): array { $rules = [ 'name' => 'required|string|max:255', 'designation' => 'required|string|max:255', 'comment' => 'required|string|max:5000', ]; if ($this->isMethod('put')) { $rules['image'] = 'nullable|image|max:2048'; } if ($this->isMethod('post')) { $rules['image'] = 'required|image|max:2048'; } return $rules; } public function messages(): array { return [ 'name.required' => __('The name field is required.'), 'name.string' => __('The name must be a string.'), 'name.max' => __('The name may not be greater than 255 characters.'), 'designation.required' => __('The designation field is required.'), 'designation.string' => __('The designation must be a string.'), 'designation.max' => __('The designation may not be greater than 255 characters.'), 'comment.required' => __('The comment field is required.'), 'comment.string' => __('The comment must be a string.'), 'comment.max' => __('The comment may not be greater than 5000 characters.'), 'image.required' => __('The image field is required.'), 'image.image' => __('The image must be an image.'), 'image.max' => __('The image may not be greater than 2048 kilobytes.'), ]; } } app/Http/Middleware/.gitkeep 0000644 00000000000 15012231571 0011734 0 ustar 00 app/Models/.gitkeep 0000644 00000000000 15012231571 0010163 0 ustar 00 app/Models/TestimonialTranslation.php 0000644 00000001110 15012231571 0013755 0 ustar 00 <?php namespace Modules\Testimonial\app\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; class TestimonialTranslation extends Model { use HasFactory; /** * The attributes that are mass assignable. */ protected $fillable = [ 'testimonial_id', 'lang_code', 'name', 'designation', 'comment', ]; public function testimonial(): ?BelongsTo { return $this->belongsTo(Testimonial::class); } } app/Models/error_log 0000644 00000001234 15012231571 0010461 0 ustar 00 [13-May-2025 02:47:01 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Database\Eloquent\Model" not found in /home/lekhnath/silverray.com.au/Modules/Testimonial/app/Models/TestimonialTranslation.php:9 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/Testimonial/app/Models/TestimonialTranslation.php on line 9 [13-May-2025 07:53:01 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Database\Eloquent\Model" not found in /home/lekhnath/silverray.com.au/Modules/Testimonial/app/Models/Testimonial.php:10 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/Testimonial/app/Models/Testimonial.php on line 10 app/Models/Testimonial.php 0000644 00000002632 15012231571 0011550 0 ustar 00 <?php namespace Modules\Testimonial\app\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasOne; class Testimonial extends Model { use HasFactory; /** * The attributes that are mass assignable. */ protected $fillable = [ 'image', 'status', ]; public function getNameAttribute(): ?string { return $this->translation->name; } public function getDesignationAttribute(): ?string { return $this->translation->designation; } public function getCommentAttribute(): ?string { return $this->translation->comment; } public function translation(): ?HasOne { return $this->hasOne(TestimonialTranslation::class)->where('lang_code', getSessionLanguage()); } public function getTranslation($code): ?TestimonialTranslation { return $this->hasOne(TestimonialTranslation::class)->where('lang_code', $code)->first(); } public function translations(): ?HasMany { return $this->hasMany(TestimonialTranslation::class, 'testimonial_id'); } public function scopeActive($query) { return $query->where('status', 1); } public function scopeInactive($query) { return $query->where('status', 0); } } app/Providers/RouteServiceProvider.php 0000644 00000002703 15012231571 0014143 0 ustar 00 <?php namespace Modules\Testimonial\app\Providers; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; use Illuminate\Support\Facades\Route; class RouteServiceProvider extends ServiceProvider { /** * The module namespace to assume when generating URLs to actions. */ protected string $moduleNamespace = 'Modules\Testimonial\app\Http\Controllers'; /** * Called before routes are registered. * * Register any model bindings or pattern based filters. */ public function boot(): void { parent::boot(); } /** * Define the routes for the application. */ public function map(): void { $this->mapApiRoutes(); $this->mapWebRoutes(); } /** * Define the "web" routes for the application. * * These routes all receive session state, CSRF protection, etc. */ protected function mapWebRoutes(): void { Route::middleware('web') ->namespace($this->moduleNamespace) ->group(module_path('Testimonial', '/routes/web.php')); } /** * Define the "api" routes for the application. * * These routes are typically stateless. */ protected function mapApiRoutes(): void { Route::prefix('api') ->middleware('api') ->namespace($this->moduleNamespace) ->group(module_path('Testimonial', '/routes/api.php')); } } app/Providers/TestimonialServiceProvider.php 0000644 00000006462 15012231571 0015343 0 ustar 00 <?php namespace Modules\Testimonial\app\Providers; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; class TestimonialServiceProvider extends ServiceProvider { protected string $moduleName = 'Testimonial'; protected string $moduleNameLower = 'testimonial'; /** * Boot the application events. */ public function boot(): void { $this->registerCommands(); $this->registerCommandSchedules(); $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); $this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations')); } /** * Register the service provider. */ public function register(): void { $this->app->register(RouteServiceProvider::class); } /** * Register commands in the format of Command::class */ protected function registerCommands(): void { // $this->commands([]); } /** * Register command Schedules. */ protected function registerCommandSchedules(): void { // $this->app->booted(function () { // $schedule = $this->app->make(Schedule::class); // $schedule->command('inspire')->hourly(); // }); } /** * Register translations. */ public function registerTranslations(): void { $langPath = resource_path('lang/modules/'.$this->moduleNameLower); if (is_dir($langPath)) { $this->loadTranslationsFrom($langPath, $this->moduleNameLower); $this->loadJsonTranslationsFrom($langPath); } else { $this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower); $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang')); } } /** * Register config. */ protected function registerConfig(): void { $this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config'); $this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower); } /** * Register views. */ public function registerViews(): void { $viewPath = resource_path('views/modules/'.$this->moduleNameLower); $sourcePath = module_path($this->moduleName, 'resources/views'); $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']); $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); $componentNamespace = str_replace('/', '\\', config('modules.namespace').'\\'.$this->moduleName.'\\'.config('modules.paths.generator.component-class.path')); Blade::componentNamespace($componentNamespace, $this->moduleNameLower); } /** * Get the services provided by the provider. */ public function provides(): array { return []; } private function getPublishableViewPaths(): array { $paths = []; foreach (config('view.paths') as $path) { if (is_dir($path.'/modules/'.$this->moduleNameLower)) { $paths[] = $path.'/modules/'.$this->moduleNameLower; } } return $paths; } } app/Providers/.gitkeep 0000644 00000000000 15012231571 0010715 0 ustar 00 database/factories/.gitkeep 0000644 00000000000 15012231571 0011703 0 ustar 00 database/migrations/2023_11_29_104658_create_testimonials_table.php 0000644 00000001204 15012231571 0020504 0 ustar 00 <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('testimonials', function (Blueprint $table) { $table->id(); $table->string('image')->nullable(); $table->boolean('status')->default(true); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('testimonials'); } }; database/migrations/.gitkeep 0000644 00000000000 15012231571 0012100 0 ustar 00 database/migrations/2023_11_29_104704_create_testimonial_translations_table.php 0000644 00000001501 15012231571 0023112 0 ustar 00 <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; use Modules\Testimonial\app\Models\Testimonial; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('testimonial_translations', function (Blueprint $table) { $table->id(); $table->foreignIdFor(Testimonial::class); $table->string('lang_code')->index(); $table->string('name'); $table->string('designation'); $table->text('comment'); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('testimonial_translations'); } }; database/seeders/TestimonialDatabaseSeeder.php 0000644 00000002426 15012231571 0015521 0 ustar 00 <?php namespace Modules\Testimonial\database\seeders; use Faker\Factory as Faker; use Illuminate\Database\Seeder; use Modules\Testimonial\app\Models\Testimonial; use Modules\Testimonial\app\Models\TestimonialTranslation; class TestimonialDatabaseSeeder extends Seeder { /** * Run the database seeds. */ public function run(): void { $faker = Faker::create(); for ($i = 0; $i < 20; $i++) { $data = new Testimonial(); $data->image = "website/images/client_img_{$faker->randomElement(['1', '2', '3'])}.jpg" ?? $faker->imageUrl; $data->rating = $faker->numberBetween(1, 5); $data->status = $faker->randomElement([true, false]); if ($data->save()) { foreach (allLanguages() as $language) { $dataTranslation = new TestimonialTranslation(); $dataTranslation->lang_code = $language->code; $dataTranslation->testimonial_id = $data->id; $dataTranslation->name = $faker->firstName; $dataTranslation->designation = $faker->jobTitle; $dataTranslation->comment = $faker->paragraph; $dataTranslation->save(); } } } } } database/seeders/.gitkeep 0000644 00000000000 15012231571 0011356 0 ustar 00 resources/assets/.gitkeep 0000644 00000000000 15012231571 0011474 0 ustar 00 resources/assets/js/app.js 0000644 00000000000 15012231571 0011575 0 ustar 00 resources/assets/sass/app.scss 0000644 00000000000 15012231571 0012471 0 ustar 00 resources/views/sidebar.blade.php 0000644 00000000460 15012231571 0013100 0 ustar 00 @if (Module::isEnabled('Testimonial') && Route::has('admin.testimonial.index')) <li class="{{ isRoute('admin.testimonial.*') ? 'active' : '' }}"> <a class="nav-link" href="{{ route('admin.testimonial.index') }}"> <span>{{ __('Testimonial') }}</span> </a> </li> @endif resources/views/edit.blade.php 0000644 00000026570 15012231571 0012426 0 ustar 00 @extends('admin.master_layout') @section('title') <title>{{ __('Edit Testimonial') }}</title> @endsection @section('admin-content') <div class="main-content"> <section class="section"> <x-admin.breadcrumb title="{{ __('Edit Testimonial') }}" :list="[ __('Dashboard') => route('admin.dashboard'), __('Testimonials') => route('admin.testimonial.index'), __('Edit Testimonial') => '#', ]" /> <div class="section-body row"> <div class="col-12"> <div class="card"> <div class="card-header gap-3 justify-content-between align-items-center"> <h5 class="m-0 service_card">{{ __('Available Translations') }}</h5> @adminCan('testimonial.translate') @if ($code !== $languages->first()->code) <x-admin.button onclick="translateAll()" id="translate-btn" :text="__('Translate')" /> @endif @endadminCan </div> <div class="card-body"> <div class="lang_list_top"> <ul class="lang_list"> @foreach (allLanguages() as $language) <li> <a id="{{ request('code') == $language->code ? 'selected-language' : '' }}" href="{{ route('admin.testimonial.edit', ['testimonial' => $testimonial->id, 'code' => $language->code]) }}"> <i class="fas {{ request('code') == $language->code ? 'fa-eye' : 'fa-edit' }}"></i> {{ $language->name }} </a> </li> @endforeach </ul> </div> <div class="mt-2 alert alert-danger" role="alert"> @php $current_language = $languages->where('code', request()->get('code'))->first(); @endphp <p>{{ __('Your editing mode') }} : <b>{{ $current_language?->name }}</b> </p> </div> </div> </div> </div> </div> <div class="section-body"> <div class="mt-4 row"> <div class="col-12"> <div class="card"> <div class="card-header d-flex justify-content-between"> <x-admin.form-title :text="__('Edit Testimonial')" /> <div> <x-admin.back-button :href="route('admin.testimonial.index')" /> </div> </div> <div class="card-body"> <form action="{{ route('admin.testimonial.update', [ 'testimonial' => $testimonial->id, 'code' => $code, ]) }}" enctype="multipart/form-data" method="post"> @csrf @method('PUT') <div class="row"> <div class="col-md-12"> <div class="form-group"> <x-admin.form-input id="name" data-translate="true" name="name" label="{{ __('Name') }}" placeholder="{{ __('Enter Name') }}" value="{{ old('name', $testimonial->getTranslation($code)->name) }}" required="true"/> </div> </div> <div class="col-md-12"> <div class="form-group"> <x-admin.form-input id="designation" data-translate="true" name="designation" label="{{ __('Designation') }}" placeholder="{{ __('Enter Designation') }}" value="{{ old('designation', $testimonial->getTranslation($code)->designation) }}" required="true"/> </div> </div> <div class="col-md-12"> <div class="form-group"> <x-admin.form-textarea data-translate="true" id="comment" name="comment" label="{{ __('Comment') }}" placeholder="{{ __('Enter Comment') }}" value="{{ old('comment', $testimonial->getTranslation($code)->comment) }}" maxlength="5000" required="true" /> </div> </div> @if ($code == $languages->first()->code) <div class="col-md-12"> <div class="form-group"> <x-admin.form-image-preview label="Image" :image="$testimonial->image" /> </div> </div> @endif @adminCan('testimonial.update') <div class="col-md-12"> <x-admin.update-button :text="__('Update')" /> </div> @endadminCan </div> </form> </div> </div> </div> </div> </div> </section> </div> @endsection @push('js') <script src="{{ asset('backend/js/jquery.uploadPreview.min.js') }}"></script> <script> "use strict"; $.uploadPreview({ input_field: "#image-upload", preview_box: "#image-preview", label_field: "#image-label", label_default: "{{ __('Choose Image') }}", label_selected: "{{ __('Change Image') }}", no_label: false, success_callback: null }); </script> <script> "use strict"; var isTranslatingInputs = true; function translateOneByOne(inputs, index = 0) { if (index >= inputs.length) { if (isTranslatingInputs) { isTranslatingInputs = false; translateAllTextarea(); } $('#translate-btn').prop('disabled', false); $('#update-btn').prop('disabled', false); return; } var $input = $(inputs[index]); var inputValue = $input.val(); if (inputValue) { $.ajax({ url: "{{ route('admin.languages.update.single') }}", type: "POST", data: { lang: '{{ $code }}', text: inputValue, _token: '{{ csrf_token() }}' }, dataType: 'json', beforeSend: function() { $input.prop('disabled', true); iziToast.show({ timeout: false, close: true, theme: 'dark', icon: 'loader', iconUrl: 'https://hub.izmirnic.com/Files/Images/loading.gif', title: "{{ __('Translation Processing, please wait...') }}", position: 'center', }); }, success: function(response) { $input.val(response); $input.prop('disabled', false); iziToast.destroy(); toastr.success("{{ __('Translated Successfully!') }}"); translateOneByOne(inputs, index + 1); }, error: function(jqXHR, textStatus, errorThrown) { console.error(textStatus, errorThrown); iziToast.destroy(); toastr.error('Error', 'Error'); } }); } else { translateOneByOne(inputs, index + 1); } } function translateAll() { iziToast.question({ timeout: 20000, close: false, overlay: true, displayMode: 'once', id: 'question', zindex: 999, title: "{{ __('This will take a while!') }}", message: "{{ __('Are you sure?') }}", position: 'center', buttons: [ ["<button><b>{{ __('Yes') }}</b></button>", function(instance, toast) { var isDemo = "{{ env('APP_MODE') ?? 'LIVE' }}"; if (isDemo == 'DEMO') { instance.hide({ transitionOut: 'fadeOut' }, toast, 'button'); toastr.error("{{ __('This Is Demo Version. You Can Not Change Anything') }}"); return; } $('#translate-btn').prop('disabled', true); $('#update-btn').prop('disabled', true); instance.hide({ transitionOut: 'fadeOut' }, toast, 'button'); var inputs = $('input[data-translate="true"]').toArray(); translateOneByOne(inputs); }, true], ["<button>{{ __('No') }}</button>", function(instance, toast) { instance.hide({ transitionOut: 'fadeOut' }, toast, 'button'); }], ], onClosing: function(instance, toast, closedBy) {}, onClosed: function(instance, toast, closedBy) {} }); }; function translateAllTextarea() { var inputs = $('textarea[data-translate="true"]').toArray(); if (inputs.length === 0) { return; } translateOneByOne(inputs); } $(document).ready(function() { var selectedTranslation = $('#selected-language').text(); var btnText = "{{ __('Translate to') }}" + selectedTranslation; $('#translate-btn').text(btnText); }); </script> @endpush resources/views/create.blade.php 0000644 00000010021 15012231571 0012724 0 ustar 00 @extends('admin.master_layout') @section('title') <title>{{ __('Create Testimonial') }}</title> @endsection @section('admin-content') <div class="main-content"> <section class="section"> <x-admin.breadcrumb title="{{ __('Create Testimonial') }}" :list="[ __('Dashboard') => route('admin.dashboard'), __('Testimonials') => route('admin.testimonial.index'), __('Create Testimonial') => '#', ]" /> <div class="section-body"> <div class="mt-4 row"> <div class="col-12"> <div class="card"> <div class="card-header d-flex justify-content-between"> <x-admin.form-title :text="__('Create Testimonial')" /> <div> <x-admin.back-button :href="route('admin.testimonial.index')" /> </div> </div> <div class="card-body"> <form action="{{ route('admin.testimonial.store') }}" enctype="multipart/form-data" method="post"> @csrf <div class="row"> <div class="col-md-12"> <div class="form-group"> <x-admin.form-input id="name" name="name" label="{{ __('Name') }}" placeholder="{{ __('Enter Name') }}" value="{{ old('name') }}" required="true"/> </div> </div> <div class="col-md-12"> <div class="form-group"> <x-admin.form-input id="designation" name="designation" label="{{ __('Designation') }}" placeholder="{{ __('Enter Designation') }}" value="{{ old('designation') }}" required="true"/> </div> </div> <div class="col-md-12"> <div class="form-group"> <x-admin.form-textarea id="comment" name="comment" label="{{ __('Comment') }}" placeholder="{{ __('Enter Comment') }}" value="{{ old('comment') }}" maxlength="5000" required="true"/> </div> </div> <div class="col-md-12"> <div class="form-group"> <x-admin.form-image-preview label="Image" required="true"/> </div> </div> @adminCan('testimonial.store') <div class="col-md-12"> <x-admin.save-button :text="__('Save')" /> </div> @endadminCan </div> </form> </div> </div> </div> </div> </div> </section> </div> @endsection @push('js') <script src="{{ asset('backend/js/jquery.uploadPreview.min.js') }}"></script> <script> "use strict"; $.uploadPreview({ input_field: "#image-upload", preview_box: "#image-preview", label_field: "#image-label", label_default: "{{ __('Choose Image') }}", label_selected: "{{ __('Change Image') }}", no_label: false, success_callback: null }); </script> @endpush resources/views/index.blade.php 0000644 00000014643 15012231571 0012606 0 ustar 00 @extends('admin.master_layout') @section('title') <title>{{ __('Testimonials') }}</title> @endsection @section('admin-content') <div class="main-content"> <section class="section"> <x-admin.breadcrumb title="{{ __('Testimonials') }}" :list="[ __('Dashboard') => route('admin.dashboard'), __('Testimonials') => '#', ]" /> <div class="section-body"> <div class="mt-4 row"> <div class="col-12"> <div class="card"> <div class="card-header d-flex justify-content-between"> <x-admin.form-title :text="__('Testimonials')" /> <div> @adminCan('testimonial.create') <x-admin.add-button :href="route('admin.testimonial.create')" /> @endadminCan </div> </div> <div class="card-body"> <div class="table-responsive max-h-400"> <table class="table table-striped"> <thead> <tr> <th>{{ __('SN') }}</th> <th>{{ __('Name') }}</th> <th>{{ __('Designation') }}</th> <th>{{ __('Image') }}</th> <th>{{ __('Status') }}</th> <th>{{ __('Action') }}</th> </tr> </thead> <tbody> @forelse ($testimonials as $testimonial) <tr> <td>{{ $loop->index + 1 }}</td> <td>{{ $testimonial->name }}</td> <td>{{ $testimonial->designation }}</td> <td><img src="{{ asset($testimonial->image) }}" alt="" class="rounded-circle my-2"> </td> <td> <input onchange="changeStatus({{ $testimonial->id }})" id="status_toggle" type="checkbox" {{ $testimonial->status ? 'checked' : '' }} data-toggle="toggle" data-onlabel="{{ __('Active') }}" data-offlabel="{{ __('Inactive') }}" data-onstyle="success" data-offstyle="danger"> </td> <td> @adminCan('testimonial.edit') <x-admin.edit-button :href="route('admin.testimonial.edit', ['testimonial' => $testimonial->id, 'code' => getSessionLanguage()])" /> @endadminCan @adminCan('testimonial.delete') <x-admin.delete-button :id="$testimonial->id" onclick="deleteData" /> @endadminCan </td> </tr> @empty @adminCan('testimonial.create') <x-empty-table :name="__('Testimonial')" route="admin.testimonial.create" create="yes" :message="__('No data found!')" colspan="6" /> @endadminCan @endforelse </tbody> </table> </div> <div class="float-right"> {{ $testimonials->onEachSide(3)->onEachSide(3)->links() }} </div> </div> </div> </div> </div> </div> </section> </div> <x-admin.delete-modal /> @endsection @push('js') <script> "use strict"; function deleteData(id) { $("#deleteForm").attr("action", "{{ url('/admin/testimonial/') }}" + "/" + id) } function changeStatus(id) { var isDemo = "{{ env('APP_MODE') ?? 'LIVE' }}"; if (isDemo == 'DEMO') { toastr.error("{{ __('This Is Demo Version. You Can Not Change Anything') }}"); return; } $.ajax({ type: "put", data: { _token: '{{ csrf_token() }}', }, url: "{{ url('/admin/testimonial/status-update') }}" + "/" + id, success: function(response) { if (response.success) { toastr.success(response.message); } else { toastr.warning(response.message); } }, error: function(err) { handleFetchError(err); } }) } </script> @endpush @push('css') <style> .dd-custom-css { position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, -131px, 0px); } .max-h-400 { min-height: 400px; } </style> @endpush
| ver. 1.4 |
Github
|
.
| PHP 8.3.20 | Генерация страницы: 0.01 |
proxy
|
phpinfo
|
Настройка