Here is the Model which simply inserts data into the table:
namespace App;
use Illuminate\Database\Eloquent\Model;
class UserHandle extends Model {
public $timestamps=false;
}
Here is the Controller:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use app\UserHandle;
class UserHandleCntrl extends Controller {
public function index(){
$data = new UserHandle;
$data->name='Laravel';
$data->email='dbtcbd@gmail.com';
$data->username='bdlaravel';
$data->password='laravel12345';
$data->save();
echo 'Data Inserted';
}
}
Here is the route :
Route::get('/user', 'UserHandleCntrl@index');
But when I am trying to insert data into the database I am getting error that model class not found. Why I am getting this and what is the solution. Please help. Bellow is the error screenshot.