11-11-2016, 07:47 PM
Code:
$usermodel = new \App\Models\UserModel();
Code:
$usermodel = new UserModel();
are they the same? which one is correct? thanks
How to load Model?
|
11-11-2016, 07:47 PM
Code: $usermodel = new \App\Models\UserModel(); Code: $usermodel = new UserModel(); are they the same? which one is correct? thanks
11-11-2016, 10:29 PM
They are only the same if you have declared the model at the top of the file:
Code: <?php namespace App\Controllers; Otherwise you'll get an error. If you haven't used them before, running through a quick crash course on namespaces would be very helpful. |