User Model
class User_Model extends Model
{
protected $table = "user";
protected $primaryKey = "UserID";
public function classes() {
return $this->hasOne('/app/Models/Classes_Model');
}
}
Classes Model
class Classes_Model extends Model
{
protected $table = "classes";
protected $primaryKey = "ClassID";
}
User Conroller
class UserController extends Controller
{
public function index()
{
//$users = \App\Models\User_Model::all();
$users = \App\Models\User_Model::find(1)->classes();
return View("\user\user", array("users" => $users));
}
}
When Controller Action Method runs...I get below error.
Class '/app/Models/Classes_Model' not found
My app structure is below
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire