laravel - FatalErrorException in Model.php line 750: Class not found Laravel5 -
i'm in process of upgrading laravel 4.2 project 5.0 i've been making reasonable progress until particular error:
fatalerrorexception in model.php line 750: class 'sapproduct' not found.
my sapproduct class called product class hasone relationship , can't work out why laravel can't find it.
sapproduct.php
namespace app\models; use eloquent; class sapproduct extends eloquent { public function brand() { return $this->belongsto('app\models\brand', 'u_brand', 'name'); } }
product.php
namespace app\models; use eloquent; class product extends eloquent { ... public function sapproduct() { $relationship = $this->hasone('app\models\sapproduct', 'itemcode', 'itemcode'); } ... }
model.php (lines 746-755)
public function hasone($related, $foreignkey = null, $localkey = null) { $foreignkey = $foreignkey ?: $this->getforeignkey(); $instance = new $related; $localkey = $localkey ?: $this->getkeyname(); return new hasone($instance->newquery(), $this, $instance->gettable().'.'.$foreignkey, $localkey); }
i apologise if i'm missing other necessary information, i'll add more as/if requested.
thanks
after spending far time on problem tracked down offending line.
the relationship had chained through model had not had it's relationship 'sapproduct' correctly namespaced.
the offending model productvariation.php , has following incorrect line:
$relationship = $this->hasone('sapproduct', 'itemcode', 'itemcode');
when needed be:
$relationship = $this->hasone('app\models\sapproduct', 'itemcode', 'itemcode');
this why laravel bring sapproduct error in capitals rather camel case.
thanks tried help!
Comments
Post a Comment