My Model is like this
class redModel extends Model {
public $table = 'tbl50red';
public $primaryKey = 'RedID';
public $timestamps = true;
}
and here is another model
class AddOnModel extends Model {
public $table = 'tbladdon';
public $primaryKey = 'AddOnID';
public $timestamps = true;
public function AppRed() {
return $this->hasMany("\App\Models\AddOn\Red\redModel", "AddOnID", "AddOnID");
}
}
In the controller when i run this:
$AddOns = AddOnModel
::with(array("AppRed" => function($query) use($StartDate, $EndDate) {
return $query->whereBetween("EarningDate", array($StartDate, $EndDate));
}))
->get();
I get an exception :
Class '\App\Models\AddOn\Red edModel' not found
Am I missing something?
This is not a bug in Laravel. Please read the PSR-1 Basic Coding Standard which will enable you to easily avoid this error in the future. Namely, this is the part you are violating: