app->bind( ImageUploadRepositoryInterface::class, ImageUploadRepository::class ); // StorageInterface 바인딩 $this->app->when([ImageUploadService::class, ImageServeService::class]) ->needs(StorageInterface::class) ->give(fn () => new PluginStorageDriver('sirsoft-ckeditor5', 'plugins')); // 라우트 등록 Route::prefix('api/plugins/sirsoft-ckeditor5') ->middleware('api') ->group(function () { Route::post('upload', [ImageUploadController::class, 'upload']) ->name('api.sirsoft-ckeditor5.upload'); Route::get('images/{hash}', [ImageServeController::class, 'serve']) ->name('api.sirsoft-ckeditor5.images.serve'); }); } /** * 관리자 권한을 가진 사용자를 생성합니다. * * @return User */ protected function createAdminUser(): User { $adminRole = Role::firstOrCreate( ['identifier' => 'admin'], ['name' => ['ko' => '관리자', 'en' => 'Admin'], 'description' => ['ko' => '관리자', 'en' => 'Admin']] ); $permission = Permission::firstOrCreate( ['identifier' => 'admin.access'], ['name' => ['ko' => '관리자 접근', 'en' => 'Admin Access'], 'type' => PermissionType::Admin] ); $adminRole->permissions()->syncWithoutDetaching([$permission->id]); $user = User::factory()->create(); $user->roles()->attach($adminRole->id); return $user; } /** * 마이그레이션 경로를 반환합니다. * * @return array */ protected function migrateFreshUsing(): array { return [ '--drop-views' => $this->shouldDropViews(), '--drop-types' => $this->shouldDropTypes(), '--seed' => false, '--path' => [ 'database/migrations', 'plugins/_bundled/sirsoft-ckeditor5/database/migrations', ], ]; } }