jezzdk / statamic-wp-import

7 stars 4 forks source link

Target class [ImportController] does not exist. #6

Closed rrrrpppp closed 10 months ago

rrrrpppp commented 11 months ago

I have the current version 4.17.0 of statamic in use and get the following error when I select "WP Import" in the backend:

Illuminate\Contracts\Container\BindingResolutionException Target class [ImportController] does not exist.

PHP 8.1.22 Laravel 10.15.0

Any suggestions how to fix this? Thanks!

linksmith commented 10 months ago

I fixed it like this. Update cp.php to explicitly use ImportController:

<?php

use Illuminate\Support\Facades\Route;
use Jezzdk\StatamicWpImport\Http\Controllers\ImportController;

Route::group(['prefix' => 'wp-import'], function () {
    Route::get('/', [ImportController::class, 'index'])->name('wp-import.index');
    Route::post('/upload', [ImportController::class, 'upload'])->name('wp-import.upload');
    Route::get('/summary', [ImportController::class, 'summary'])->name('wp-import.summary');
    Route::post('/import', [ImportController::class, 'import'])->name('wp-import.import');
});

I added this update as a Pull Request #7

rrrrpppp commented 10 months ago

Great, i can confirm that it works now. Thank you