When I enable CamelCasing on my Model it breaks the hasMany relationship.
<?php
namespace App\BuildCtrl;
use Illuminate\Database\Eloquent\Model;
use \Eloquence\Behaviours\CamelCasing;
class GlobalDetails extends Model
{
use CamelCasing;
protected $connection = 'competentpersons';
protected $table = 'vwGlobalDetails';
protected $primarykey = 'RecordSetKey';
public $timestamps = false;
public function workDescription() {
return $this->hasMany(WorkDescription::class, 'RecordSetKey', 'RecordSetKey');
}
}
"work_description":[{"RecordSetKey":"287","ID":"361","DescriptionOfWorkItem":"Dwelling house"},{"RecordSetKey":"287","ID":"362","DescriptionOfWorkItem":"New consumer unit"},{"RecordSetKey":"287","ID":"363","DescriptionOfWorkItem":"Kitchen"},{"RecordSetKey":"287","ID":"364","DescriptionOfWorkItem":"Cooker"},{"RecordSetKey":"287","ID":"365","DescriptionOfWorkItem":"New installation, rewire or partial rewire"},{"RecordSetKey":"287","ID":"366","DescriptionOfWorkItem":"One or more new circuits"}]
Trouble is I'm using this with vue.js so CamelCasing is really helpful.
When I enable CamelCasing on my Model it breaks the hasMany relationship.
Using:
returns:
If I disable CamelCasing:
Trouble is I'm using this with vue.js so CamelCasing is really helpful.