Файловый менеджер - Редактировать - /home/c7lekhnath/silverray.com.au/Modules/Language/database/seeders/68334/Service.tar
Назад
lang/.gitkeep 0000644 00000000000 15012235457 0007110 0 ustar 00 module.json 0000644 00000000336 15012235457 0006732 0 ustar 00 { "name": "Service", "alias": "service", "description": "", "keywords": [], "priority": 0, "providers": [ "Modules\\Service\\app\\Providers\\ServiceServiceProvider" ], "files": [] } tests/Unit/.gitkeep 0000644 00000000000 15012235457 0010250 0 ustar 00 tests/Feature/.gitkeep 0000644 00000000000 15012235457 0010724 0 ustar 00 vite.config.js 0000644 00000001304 15012235457 0007317 0 ustar 00 import { defineConfig } from 'vite'; import laravel from 'laravel-vite-plugin'; export default defineConfig({ build: { outDir: '../../public/build-service', emptyOutDir: true, manifest: true, }, plugins: [ laravel({ publicDirectory: '../../public', buildDirectory: 'build-service', 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 15012235457 0007510 0 ustar 00 routes/error_log 0000644 00000001104 15012235457 0010002 0 ustar 00 [07-May-2025 15:01:46 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Support\Facades\Route" not found in /home/lekhnath/silverray.com.au/Modules/Service/routes/web.php:17 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/Service/routes/web.php on line 17 [07-May-2025 16:30:11 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Support\Facades\Route" not found in /home/lekhnath/silverray.com.au/Modules/Service/routes/api.php:17 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/Service/routes/api.php on line 17 routes/web.php 0000644 00000001521 15012235457 0007356 0 ustar 00 <?php use Illuminate\Support\Facades\Route; use Modules\Service\app\Http\Controllers\ServiceController; /* |-------------------------------------------------------------------------- | 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::resource('service', ServiceController::class)->names('service'); Route::put('/service/status-update/{id}', [ServiceController::class, 'statusUpdate'])->name('service.status-update'); } ); routes/api.php 0000644 00000001233 15012235457 0007352 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('service', fn (Request $request) => $request->user())->name('service'); }); composer.json 0000644 00000001275 15012235457 0007277 0 ustar 00 { "name": "nwidart/service", "description": "", "authors": [ { "name": "Nicolas Widart", "email": "n.widart@gmail.com" } ], "extra": { "laravel": { "providers": [], "aliases": { } } }, "autoload": { "psr-4": { "Modules\\Service\\": "", "Modules\\Service\\App\\": "app/", "Modules\\Service\\Database\\Factories\\": "database/factories/", "Modules\\Service\\Database\\Seeders\\": "database/seeders/" } }, "autoload-dev": { "psr-4": { "Modules\\Service\\Tests\\": "tests/" } } } config/config.php 0000644 00000000054 15012235457 0007772 0 ustar 00 <?php return [ 'name' => 'Service', ]; config/.gitkeep 0000644 00000000000 15012235457 0007434 0 ustar 00 package.json 0000644 00000000410 15012235457 0007031 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/ServiceController.php 0000644 00000006732 15012235457 0014742 0 ustar 00 <?php namespace Modules\Service\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\Pagination\Paginator; use Illuminate\Http\RedirectResponse; use Modules\Service\app\Models\Service; use Modules\Language\app\Models\Language; use Modules\Language\app\Enums\TranslationModels; use Modules\Service\app\Http\Requests\ServiceRequest; use Modules\Language\app\Traits\GenerateTranslationTrait; class ServiceController extends Controller { use GenerateTranslationTrait, RedirectHelperTrait; public function index() { checkAdminHasPermissionAndThrowException('service.view'); Paginator::useBootstrap(); $services = Service::with('translation')->paginate(15); return view('service::index', compact('services')); } public function create() { checkAdminHasPermissionAndThrowException('service.create'); return view('service::create'); } public function store(ServiceRequest $request) { checkAdminHasPermissionAndThrowException('service.store'); $service = Service::create($request->validated()); $languages = allLanguages(); $this->generateTranslations( TranslationModels::Service, $service, 'service_id', $request, ); return $this->redirectWithMessage(RedirectType::CREATE->value, 'admin.service.edit', ['service' => $service->id, 'code' => $languages->first()->code]); } public function show($id) { checkAdminHasPermissionAndThrowException('service.view'); return view('service::show'); } public function edit($id) { checkAdminHasPermissionAndThrowException('service.edit'); $code = request('code') ?? getSessionLanguage(); abort_unless(Language::where('code', $code)->exists(), 404); $service = Service::with('translation')->findOrFail($id); $languages = allLanguages(); return view('service::edit', compact('service', 'code', 'languages')); } public function update(serviceRequest $request, $id) { checkAdminHasPermissionAndThrowException('service.update'); $service = Service::findOrFail($id); $validatedData = $request->validated(); $service->update($validatedData); $this->updateTranslations( $service, $request, $validatedData, ); return $this->redirectWithMessage(RedirectType::UPDATE->value, 'admin.service.edit', ['service' => $service->id, 'code' => $request->code]); } public function destroy($id) { checkAdminHasPermissionAndThrowException('service.delete'); $service = Service::findOrFail($id); $service->translations()->each(function ($translation) { $translation->delete(); }); $service->delete(); return $this->redirectWithMessage(RedirectType::DELETE->value, 'admin.service.index'); } public function statusUpdate($id) { checkAdminHasPermissionAndThrowException('service.update'); $service = Service::find($id); $status = $service->status == 1 ? 0 : 1; $service->update(['status' => $status]); $notification = __('Updated Successfully'); return response()->json([ 'success' => true, 'message' => $notification, ]); } } app/Http/Controllers/.gitkeep 0000644 00000000000 15012235457 0012174 0 ustar 00 app/Http/Controllers/error_log 0000644 00000000531 15012235457 0012471 0 ustar 00 [13-May-2025 20:57:02 UTC] PHP Fatal error: Uncaught Error: Class "App\Http\Controllers\Controller" not found in /home/lekhnath/silverray.com.au/Modules/Service/app/Http/Controllers/ServiceController.php:18 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/Service/app/Http/Controllers/ServiceController.php on line 18 app/Http/Requests/ServiceRequest.php 0000644 00000002321 15012235457 0013542 0 ustar 00 <?php namespace Modules\Service\app\Http\Requests; use Illuminate\Foundation\Http\FormRequest; use Auth; class ServiceRequest extends FormRequest { public function authorize(): bool { return (Auth::guard('admin')->check() && checkAdminHasPermission('service.update')) ? true : false; } public function rules(): array { $languages = allLanguages(); $rules = [ 'title' => 'required|string|max:255', 'description' => 'required', ]; if ($this->isMethod('put')) { $rules['icon'] = $this->code == $languages->first()->code ? 'required':''; } if ($this->isMethod('post')) { $rules['icon'] = 'required'; } return $rules; } public function messages(): array { return [ 'title.required' => __('The title field is required.'), 'title.string' => __('The title must be a string.'), 'title.max' => __('The title may not be greater than 255 characters.'), 'icon.required' => __('The icon field is required.'), 'description.required' => __('The description field is required.'), ]; } } app/Http/Requests/.gitkeep 0000644 00000000000 15012235457 0011501 0 ustar 00 app/Http/Middleware/.gitkeep 0000644 00000000000 15012235457 0011743 0 ustar 00 app/Models/Service.php 0000644 00000002646 15012235457 0010674 0 ustar 00 <?php namespace Modules\Service\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\Service\Database\factories\ServiceFactory; class Service extends Model { use HasFactory; /** * The attributes that are mass assignable. */ protected $fillable = ['icon','status']; protected static function newFactory(): ServiceFactory { //return ServiceFactory::new(); } public function getTitleAttribute(): ?string { return $this->translation->title; } public function getDescriptionAttribute(): ?string { return $this->translation->description; } public function translation(): ?HasOne { return $this->hasOne(ServiceTranslation::class)->where('lang_code', getSessionLanguage()); } public function getTranslation($code): ?ServiceTranslation { return $this->hasOne(ServiceTranslation::class)->where('lang_code', $code)->first(); } public function translations(): ?HasMany { return $this->hasMany(ServiceTranslation::class, 'service_id'); } public function scopeActive($query) { return $query->where('status', 1); } public function scopeInactive($query) { return $query->where('status', 0); } } app/Models/.gitkeep 0000644 00000000000 15012235457 0010172 0 ustar 00 app/Models/ServiceTranslation.php 0000644 00000001015 15012235457 0013100 0 ustar 00 <?php namespace Modules\Service\app\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Factories\HasFactory; use Modules\Service\Database\factories\ServiceTranslationFactory; class ServiceTranslation extends Model { use HasFactory; /** * The attributes that are mass assignable. */ protected $fillable = ['title','description']; protected static function newFactory(): ServiceTranslationFactory { //return ServiceTranslationFactory::new(); } } app/Providers/RouteServiceProvider.php 0000644 00000002663 15012235457 0014157 0 ustar 00 <?php namespace Modules\Service\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\Service\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('Service', '/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('Service', '/routes/api.php')); } } app/Providers/.gitkeep 0000644 00000000000 15012235457 0010724 0 ustar 00 app/Providers/ServiceServiceProvider.php 0000644 00000006442 15012235457 0014460 0 ustar 00 <?php namespace Modules\Service\app\Providers; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; class ServiceServiceProvider extends ServiceProvider { protected string $moduleName = 'Service'; protected string $moduleNameLower = 'service'; /** * 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/error_log 0000644 00000001306 15012235457 0011222 0 ustar 00 [14-May-2025 09:08:14 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Foundation\Support\Providers\RouteServiceProvider" not found in /home/lekhnath/silverray.com.au/Modules/Service/app/Providers/RouteServiceProvider.php:8 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/Service/app/Providers/RouteServiceProvider.php on line 8 [14-May-2025 16:51:04 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Support\ServiceProvider" not found in /home/c7lekhnath/silverray.com.au/Modules/Service/app/Providers/ServiceServiceProvider.php:8 Stack trace: #0 {main} thrown in /home/c7lekhnath/silverray.com.au/Modules/Service/app/Providers/ServiceServiceProvider.php on line 8 database/factories/.gitkeep 0000644 00000000000 15012235457 0011712 0 ustar 00 database/migrations/2024_07_24_104915_create_service_translations_table.php 0000644 00000001347 15012235457 0022246 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('service_translations', function (Blueprint $table) { $table->id(); $table->integer('service_id'); $table->string('lang_code'); $table->string('title')->nullable(); $table->text('description')->nullable(); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('service_translations'); } }; database/migrations/.gitkeep 0000644 00000000000 15012235457 0012107 0 ustar 00 database/migrations/2024_07_24_104814_create_services_table.php 0000644 00000001154 15012235457 0017622 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('services', function (Blueprint $table) { $table->id(); $table->string('icon'); $table->boolean('status')->default(1); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('services'); } }; database/seeders/ServiceDatabaseSeeder.php 0000644 00000000373 15012235457 0014637 0 ustar 00 <?php namespace Modules\Service\database\seeders; use Illuminate\Database\Seeder; class ServiceDatabaseSeeder extends Seeder { /** * Run the database seeds. */ public function run(): void { // $this->call([]); } } database/seeders/.gitkeep 0000644 00000000000 15012235457 0011365 0 ustar 00 database/seeders/error_log 0000644 00000000526 15012235457 0011666 0 ustar 00 [09-May-2025 03:25:17 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Database\Seeder" not found in /home/lekhnath/silverray.com.au/Modules/Service/database/seeders/ServicePermissionSeeder.php:9 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/Service/database/seeders/ServicePermissionSeeder.php on line 9 database/seeders/ServicePermissionSeeder.php 0000644 00000002455 15012235457 0015266 0 ustar 00 <?php namespace Modules\Service\database\seeders; use Illuminate\Database\Seeder; use Spatie\Permission\Models\Role; use Spatie\Permission\Models\Permission; class ServicePermissionSeeder extends Seeder { /** * Run the database seeds. */ public function run(): void { $roleSuperAdmin = Role::where(['guard_name' => 'admin'])->first(); $permissions = [ [ 'group_name' => 'Service', 'permissions' => [ 'service.create', 'service.store', 'service.view', 'service.update', 'service.edit', 'service.delete', 'service.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); } } } } resources/assets/.gitkeep 0000644 00000000000 15012235457 0011503 0 ustar 00 resources/assets/js/app.js 0000644 00000000000 15012235457 0011604 0 ustar 00 resources/assets/sass/app.scss 0000644 00000000000 15012235457 0012500 0 ustar 00 resources/views/sidebar.blade.php 0000644 00000000263 15012235460 0013102 0 ustar 00 <li class="{{ isRoute('admin.service.*', 'active') }}"> <a class="nav-link" href="{{ route('admin.service.index') }}"> <span>{{ __('Services') }}</span> </a> </li>