Laravel 5.5 ( Class 'App\Http\Controllers\ImportWord' not found ) Code : if ($request->has('upload')) {
$profilesUpload=[];
$fileStatuses = [];
foreach ($request->profile_files as $file) {
$data = $request->except($exceptCols);
foreach($data as $key=>$value)
{
if(is_null($value) || $value == '')
unset($data[$key]);
}
$dataAr = ImportWord::import((String) $file);
File :
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Validation\Rule;
use Illuminate\Support\Facades\Gate;
use App\Http\Controllers\ImportWord;
use App\Models\Profile;
use App\Models\ProfileExtra;
use App\Models\User;
use App\Models\Notification;
use Auth, Carbon\Carbon;
use App\Models\ProfileImage;
use App\Models\Match;
use Intervention\Image\ImageManager;
You have this:
use App\Http\Controllers\ImportWord;
Is that ImportWord really in Controllers? I don't think so.
@Sinnbeck
if ($request->has('upload')) {
$profilesUpload=[];
$fileStatuses = [];
foreach ($request->profile_files as $file) {
$data = $request->except($exceptCols);
foreach($data as $key=>$value)
{
if(is_null($value) || $value == '')
unset($data[$key]);
}
$dataAr = ImportWord::import((String) $file);
if (!$dataAr) {
$fileStatuses['errors'][] = $file->getClientOriginalName();
\Log::error('Profile File Upload Error : ' . $file->getClientOriginalName());
}
@teampoison that does not look like the full ImportWord.php. I mean the complete file content
@teampoison add ``` on the line before and after the code (on an empty line)
@Sinnbeck its was on app/helpers/importprofile.php
pastebin . com/raw/x89sEBWL
@teampoison does it have a namespace? If not, remove it in the import (use)
use ImportWord
@Sinnbeck i already used this every time this error come
Class 'ImportWord' not found
@teampoison saw the picture
use App\Http\Helpers\ImportWord;
But it seems your files does not follow psr 4 autoloading so it might not work. I suggest watching the beginner tutorial on php on this site
@Sinnbeck
Class 'App\Http\Helpers\ImportWord' not found
@teampoison 🤷♂️ that tell me nothing. Did you change the namespace in the file?
@Sinnbeck no i did not change anything from code. But beofre 1-2 month code will work fine. i just download i from server and run
@teampoison if you didn't change anything, can't you just download it again? It the code publicly available?
@Sinnbeck I download it again but same error . No its not publicly available
@Sinnbeck when i do composer dump autoload i see this error in cmd
Class App\Http\Helpers\ImportWord located in C:/xampp/htdocs/app\Helpers\ImportWord.php does not comply with psr-4 autoloading standard. Skipping.
Class App\Http\Helpers\ImportWord located in C:/xampp/htdocs/app\Http\Controllers\ImportWord.php does not comply with psr-4 autoloading standard. Skipping.
main issue is also in importword
@teampoison yes that is what I have been saying
But it seems your files does not follow psr 4 autoloading so it might not work
i fix it but again same error class not found
@teampoison if I am to help, I need to know what the current state is. I cannot guess it
Please sign in or create an account to participate in this conversation.