dimanche 29 novembre 2015

Model not found Error - Laravel 5

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

enter image description here



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire