Файловый менеджер - Редактировать - /home/c7lekhnath/silverray.com.au/Modules/Language/database/seeders/68334/PrivacyPolicy.tar
Назад
lang/.gitkeep 0000644 00000000000 15012235000 0007070 0 ustar 00 module.json 0000644 00000000366 15012235000 0006715 0 ustar 00 { "name": "PrivacyPolicy", "alias": "privacypolicy", "description": "", "keywords": [], "priority": 0, "providers": [ "Modules\\PrivacyPolicy\\app\\Providers\\PrivacyPolicyServiceProvider" ], "files": [] } tests/Unit/.gitkeep 0000644 00000000000 15012235000 0010230 0 ustar 00 tests/Feature/.gitkeep 0000644 00000000000 15012235000 0010704 0 ustar 00 vite.config.js 0000644 00000001320 15012235000 0007275 0 ustar 00 import { defineConfig } from 'vite'; import laravel from 'laravel-vite-plugin'; export default defineConfig({ build: { outDir: '../../public/build-privacypolicy', emptyOutDir: true, manifest: true, }, plugins: [ laravel({ publicDirectory: '../../public', buildDirectory: 'build-privacypolicy', 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', //]; routes/.gitkeep 0000644 00000000000 15012235001 0007471 0 ustar 00 routes/error_log 0000644 00000001134 15012235001 0007766 0 ustar 00 [07-May-2025 19:18:44 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Support\Facades\Route" not found in /home/lekhnath/silverray.com.au/Modules/PrivacyPolicy/routes/api.php:17 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/PrivacyPolicy/routes/api.php on line 17 [07-May-2025 20:04:30 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Support\Facades\Route" not found in /home/lekhnath/silverray.com.au/Modules/PrivacyPolicy/routes/web.php:16 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/PrivacyPolicy/routes/web.php on line 16 routes/web.php 0000644 00000001534 15012235001 0007343 0 ustar 00 <?php use Illuminate\Support\Facades\Route; use Modules\PrivacyPolicy\app\Http\Controllers\PrivacyPolicyController; /* |-------------------------------------------------------------------------- | Web Routes |-------------------------------------------------------------------------- | | Here is where you can register web routes for your application. These | routes are loaded by the RouteServiceProvider within a group which | contains the "web" middleware group. Now create something great! | */ Route::middleware(['auth:admin', 'translation']) ->name('admin.') ->prefix('admin') ->group( function () { Route::get('privacy-policy', [PrivacyPolicyController::class, 'index'])->name('privacy-policy'); Route::put('privacy-policy-update', [PrivacyPolicyController::class, 'update'])->name('privacy-policy-update'); }); routes/api.php 0000644 00000001247 15012235001 0007340 0 ustar 00 <?php use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; /* |-------------------------------------------------------------------------- | API Routes |-------------------------------------------------------------------------- | | Here is where you can register API routes for your application. These | routes are loaded by the RouteServiceProvider within a group which | is assigned the "api" middleware group. Enjoy building your API! | */ Route::middleware(['auth:sanctum'])->prefix('v1')->name('api.')->group(function () { Route::get('privacypolicy', fn (Request $request) => $request->user())->name('privacypolicy'); }); composer.json 0000644 00000001341 15012235001 0007252 0 ustar 00 { "name": "nwidart/privacypolicy", "description": "", "authors": [ { "name": "Nicolas Widart", "email": "n.widart@gmail.com" } ], "extra": { "laravel": { "providers": [], "aliases": { } } }, "autoload": { "psr-4": { "Modules\\PrivacyPolicy\\": "", "Modules\\PrivacyPolicy\\App\\": "app/", "Modules\\PrivacyPolicy\\Database\\Factories\\": "database/factories/", "Modules\\PrivacyPolicy\\Database\\Seeders\\": "database/seeders/" } }, "autoload-dev": { "psr-4": { "Modules\\PrivacyPolicy\\Tests\\": "tests/" } } } config/config.php 0000644 00000000062 15012235001 0007752 0 ustar 00 <?php return [ 'name' => 'PrivacyPolicy', ]; config/.gitkeep 0000644 00000000000 15012235001 0007415 0 ustar 00 package.json 0000644 00000000410 15012235001 0007012 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 15012235001 0012155 0 ustar 00 app/Http/Controllers/PrivacyPolicyController.php 0000644 00000003317 15012235001 0016114 0 ustar 00 <?php namespace Modules\PrivacyPolicy\app\Http\Controllers; use App\Enums\RedirectType; use Illuminate\Http\Request; use Illuminate\Http\Response; use App\Traits\RedirectHelperTrait; use App\Http\Controllers\Controller; use Illuminate\Http\RedirectResponse; use Modules\Language\app\Models\Language; use Modules\PrivacyPolicy\app\Models\PrivacyPolicy; use Modules\Language\app\Traits\GenerateTranslationTrait; use Modules\PrivacyPolicy\app\Http\Requests\PrivacyPolicyRequest; use Modules\PrivacyPolicy\app\Models\PrivacyPolicyTranslation; class PrivacyPolicyController extends Controller { use RedirectHelperTrait, GenerateTranslationTrait; public function index() { checkAdminHasPermissionAndThrowException('privacy.policy.view'); $privacy_policy = PrivacyPolicy::first(); $code = request('code') ?? getSessionLanguage(); if (!Language::where('code', $code)->exists()) { abort(404); } $languages = allLanguages(); return view('privacypolicy::index', compact('privacy_policy', 'code', 'languages')); } public function update(PrivacyPolicyRequest $request): RedirectResponse { checkAdminHasPermissionAndThrowException('privacy.policy.update'); $validatedData = $request->validated(); $privacy_policy = PrivacyPolicy::first(); $this->updateTranslations( $privacy_policy, $request, $validatedData, ); return $this->redirectWithMessage( RedirectType::UPDATE->value, 'admin.privacy-policy', [ 'privacy_policy' => $privacy_policy->id, 'code' => $request->code, ] ); } } app/Http/Requests/.gitkeep 0000644 00000000000 15012235001 0011462 0 ustar 00 app/Http/Requests/PrivacyPolicyRequest.php 0000644 00000001071 15012235001 0014721 0 ustar 00 <?php namespace Modules\PrivacyPolicy\app\Http\Requests; use Illuminate\Foundation\Http\FormRequest; class PrivacyPolicyRequest extends FormRequest { /** * Get the validation rules that apply to the request. */ public function rules(): array { $languages = allLanguages(); $rules = [ 'privacy_policy' => 'required', ]; return $rules; } public function messages(): array { return [ 'privacy_policy.required' => trans('Privacy policy is required'), ]; } } app/Http/Requests/error_log 0000644 00000000552 15012235001 0011762 0 ustar 00 [08-May-2025 12:11:11 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Foundation\Http\FormRequest" not found in /home/lekhnath/silverray.com.au/Modules/PrivacyPolicy/app/Http/Requests/PrivacyPolicyRequest.php:7 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/PrivacyPolicy/app/Http/Requests/PrivacyPolicyRequest.php on line 7 app/Http/Middleware/.gitkeep 0000644 00000000000 15012235001 0011724 0 ustar 00 app/Models/.gitkeep 0000644 00000000000 15012235001 0010153 0 ustar 00 app/Models/error_log 0000644 00000000514 15012235001 0010451 0 ustar 00 [08-May-2025 22:10:11 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Database\Eloquent\Model" not found in /home/lekhnath/silverray.com.au/Modules/PrivacyPolicy/app/Models/PrivacyPolicy.php:12 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/PrivacyPolicy/app/Models/PrivacyPolicy.php on line 12 app/Models/PrivacyPolicy.php 0000644 00000002220 15012235001 0012036 0 ustar 00 <?php namespace Modules\PrivacyPolicy\app\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Factories\HasFactory; use Modules\PrivacyPolicy\app\Models\PrivacyPolicyTranslation; use Modules\PrivacyPolicy\Database\factories\PrivacyPolicyFactory; class PrivacyPolicy extends Model { use HasFactory; /** * The attributes that are mass assignable. */ protected $fillable = []; protected static function newFactory(): PrivacyPolicyFactory { //return PrivacyPolicyFactory::new(); } public function getTranslation($code): ?PrivacyPolicyTranslation { return $this->hasOne(PrivacyPolicyTranslation::class)->where('lang_code', $code)->first(); } public function translations(): ?HasMany { return $this->hasMany(PrivacyPolicyTranslation::class, 'privacy_policy_id'); } public function translation(): ?HasOne { return $this->hasOne(PrivacyPolicyTranslation::class, 'privacy_policy_id')->where('lang_code', getSessionLanguage()); } } app/Models/PrivacyPolicyTranslation.php 0000644 00000001054 15012235001 0014261 0 ustar 00 <?php namespace Modules\PrivacyPolicy\app\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Factories\HasFactory; use Modules\PrivacyPolicy\Database\factories\PrivacyPolicyTranslationFactory; class PrivacyPolicyTranslation extends Model { use HasFactory; /** * The attributes that are mass assignable. */ protected $fillable = ['privacy_policy']; protected static function newFactory(): PrivacyPolicyTranslationFactory { //return PrivacyPolicyTranslationFactory::new(); } } app/Providers/RouteServiceProvider.php 0000644 00000002713 15012235001 0014134 0 ustar 00 <?php namespace Modules\PrivacyPolicy\app\Providers; use Illuminate\Support\Facades\Route; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; class RouteServiceProvider extends ServiceProvider { /** * The module namespace to assume when generating URLs to actions. */ protected string $moduleNamespace = 'Modules\PrivacyPolicy\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('PrivacyPolicy', '/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('PrivacyPolicy', '/routes/api.php')); } } app/Providers/.gitkeep 0000644 00000000000 15012235001 0010705 0 ustar 00 app/Providers/error_log 0000644 00000001356 15012235001 0011210 0 ustar 00 [17-May-2025 02:38:15 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Support\ServiceProvider" not found in /home/c7lekhnath/silverray.com.au/Modules/PrivacyPolicy/app/Providers/PrivacyPolicyServiceProvider.php:8 Stack trace: #0 {main} thrown in /home/c7lekhnath/silverray.com.au/Modules/PrivacyPolicy/app/Providers/PrivacyPolicyServiceProvider.php on line 8 [17-May-2025 10:14:57 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Foundation\Support\Providers\RouteServiceProvider" not found in /home/c7lekhnath/silverray.com.au/Modules/PrivacyPolicy/app/Providers/RouteServiceProvider.php:8 Stack trace: #0 {main} thrown in /home/c7lekhnath/silverray.com.au/Modules/PrivacyPolicy/app/Providers/RouteServiceProvider.php on line 8 app/Providers/PrivacyPolicyServiceProvider.php 0000644 00000006472 15012235001 0015641 0 ustar 00 <?php namespace Modules\PrivacyPolicy\app\Providers; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; class PrivacyPolicyServiceProvider extends ServiceProvider { protected string $moduleName = 'PrivacyPolicy'; protected string $moduleNameLower = 'privacypolicy'; /** * 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; } } database/factories/.gitkeep 0000644 00000000000 15012235001 0011673 0 ustar 00 database/migrations/.gitkeep 0000644 00000000000 15012235001 0012070 0 ustar 00 database/migrations/2024_01_15_110446_create_privacy_policy_translations_table.php 0000644 00000001306 15012235001 0023604 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('privacy_policy_translations', function (Blueprint $table) { $table->id(); $table->integer('privacy_policy_id'); $table->string('lang_code'); $table->longText('privacy_policy'); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('privacy_policy_translations'); } }; database/migrations/error_log 0000644 00000000646 15012235001 0012374 0 ustar 00 [08-May-2025 03:26:00 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Database\Migrations\Migration" not found in /home/lekhnath/silverray.com.au/Modules/PrivacyPolicy/database/migrations/2024_01_15_110328_create_privacy_policies_table.php:7 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/PrivacyPolicy/database/migrations/2024_01_15_110328_create_privacy_policies_table.php on line 7 database/migrations/2024_01_15_110328_create_privacy_policies_table.php 0000644 00000001062 15012235001 0021311 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('privacy_policies', function (Blueprint $table) { $table->id(); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('privacy_policies'); } }; database/seeders/.gitkeep 0000644 00000000000 15012235001 0011346 0 ustar 00 database/seeders/PrivacyPolicyPermissionSeeder.php 0000644 00000002311 15012235001 0016433 0 ustar 00 <?php namespace Modules\PrivacyPolicy\database\seeders; use Illuminate\Database\Seeder; use Spatie\Permission\Models\Role; use Spatie\Permission\Models\Permission; class PrivacyPolicyPermissionSeeder extends Seeder { /** * Run the database seeds. */ public function run(): void { $roleSuperAdmin = Role::where(['guard_name' => 'admin'])->first(); $permissions = [ [ 'group_name' => 'privacy policy', 'permissions' => [ 'privacy.policy.view', 'privacy.policy.update', 'privacy.policy.translate', ] ], ]; for ($i = 0; $i < count($permissions); $i++) { $permissionGroup = $permissions[$i]['group_name']; for ($j = 0; $j < count($permissions[$i]['permissions']); $j++) { $permission = Permission::create([ 'name' => $permissions[$i]['permissions'][$j], 'group_name' => $permissionGroup, 'guard_name' => 'admin' ]); $roleSuperAdmin->givePermissionTo($permission); } } } } database/seeders/error_log 0000644 00000001330 15012235001 0011641 0 ustar 00 [08-May-2025 02:45:48 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Database\Seeder" not found in /home/lekhnath/silverray.com.au/Modules/PrivacyPolicy/database/seeders/PrivacyPolicyDatabaseSeeder.php:9 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/PrivacyPolicy/database/seeders/PrivacyPolicyDatabaseSeeder.php on line 9 [08-May-2025 03:24:40 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Database\Seeder" not found in /home/lekhnath/silverray.com.au/Modules/PrivacyPolicy/database/seeders/PrivacyPolicyPermissionSeeder.php:9 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/PrivacyPolicy/database/seeders/PrivacyPolicyPermissionSeeder.php on line 9 database/seeders/PrivacyPolicyDatabaseSeeder.php 0000644 00000001447 15012235001 0016020 0 ustar 00 <?php namespace Modules\PrivacyPolicy\database\seeders; use Illuminate\Database\Seeder; use Modules\PrivacyPolicy\app\Models\PrivacyPolicy; use Modules\PrivacyPolicy\app\Models\PrivacyPolicyTranslation; class PrivacyPolicyDatabaseSeeder extends Seeder { /** * Run the database seeds. */ public function run(): void { $privacy_policy = new PrivacyPolicy(); $privacy_policy->save(); $languages = allLanguages(); foreach($languages as $language){ $translation = new PrivacyPolicyTranslation(); $translation->privacy_policy_id = $privacy_policy->id; $translation->lang_code = $language->code; $translation->privacy_policy = 'Privacy Policy Text'; $translation->save(); } } } resources/assets/.gitkeep 0000644 00000000000 15012235001 0011464 0 ustar 00 resources/assets/js/app.js 0000644 00000000000 15012235001 0011565 0 ustar 00 resources/assets/sass/app.scss 0000644 00000000000 15012235001 0012461 0 ustar 00 resources/views/sidebar.blade.php 0000644 00000000351 15012235001 0013067 0 ustar 00 <li class="{{ Route::is('admin.privacy-policy') ? 'active' : '' }}"> <a class="nav-link" href="{{ route('admin.privacy-policy', ['code' => getSessionLanguage()]) }}"> <span>{{ __('Privacy Policy') }}</span> </a> </li>