Closed gburu98-zz closed 8 years ago
What version of Laravel are you using?
Using Laravel 5.2.31
Can you please try use NeoEloquent
instead of use Vinelab\NeoEloquent\EloquentModel as NeoEloquent
in your model class.
Also make sure you have the NeoEloquentServiceProvider
in your providers
array in config/app.php
I did what you told me, but still the same error "Call to a member function save() on null "... now is save() and no phone ()
Oh just noticed that your relationship method has 'Phone'
while it should be the actual class name with the full namespace. (i.e. App\Phone
) or with a use App\Phone
at the top you may use Phone::class
. Can you please confirm?
I leave my routes.php images and test.php (Model)
It is not required that you create
the phone prior to calling $user->phone()->save($phone1);
. You may try one of the following:
$prueba = Prueba::createWith(['name' => 'A'], [
'phone' => [
'number' => '123123',
]
]);
// get the phone
$phone = $prueba->phone;
Or if you wish to keep them separated you can use attach
instead of save
$prueba = Prueba::create(['name' => 'A']);
$phone = Phone::create(['number' => '987654321']);
$prueba->phone()->attach($phone);
It worked perfectly, thank you very much to solve my problem!!!
As I locate the relationship via Neo4j browser, but I found the node "0 relationships"...
@gburu98 glad it worked 😄
That's probably the Neo4j browser saying that it is not Displaying any relationships, can you please try double-clicking that node?
Thanks again!!! I'm new to Neo4j, sorry for my rookie mistakes. They did an excellent job in NeoEloquent I congratulate you!
When trying to save a relationship he answers: Call to a member function phone() on null, which it is the failure?