Reputation: 119
Getting an error - Class 'Ientry' not found on Laravel 5.6. while running page localhost/work/i-upload-panel
My route.php code is below
Route::get('/i-upload-panel', function () {
(new Ientry())->importToDb();
dd('done');
return view('admin.i-upload-panel');
}
);
Model Ientry.php
<?php
namespace App\Http\Model;
use Illuminate\Database\Eloquent\Model;
class Ientry extends Model
{
public function importToDb()
{
//Function here
}
}
Upvotes: 0
Views: 1568
Reputation: 15296
As you said it is model then you have to use a namespace with the model then you can create instance of that class.
(new App\Http\Model\Ientry())->importToDb();
or
(new \App\Http\Model\Ientry())->importToDb();
Upvotes: 3
Reputation: 181
It looks you're attempting to use an imported as opposed to a fully qualified reference to it. The route files don't normally have a namespace declaration, so the best bet would be to explicitly reference.
It would be something like:
(new \App\Model\Ientry())->importToDb();
Upvotes: 1