Open SammyK opened 10 years ago
I'm trying to test one similar function but I get the same error:
public function testBelongsToEmployee()
{
$this->assertBelongsToMany('employees', Service::class);
}
public function employees()
{
return $this->belongsToMany(
Employee::class,
'catalogo_servicios_roles_empleados',
'id_servicio',
'id_empleado'
)->withPivot('id_rol');
}
_PHP Fatal error: Call to a member function withPivot() on a non-object in /srv/www/vhosts/api.globalsuite/app/Models/Services/Service.php on line 162 _
Now we can add ->withPivot() and ->withTimestamps() methods to model relationship methods without errors.
This fixes issue #30.