Implement getQualifiedKeyName method on Laravel Bridge Model
Opened this issue · 2 comments
mathieufrh commented
Hello,
I want to use the getQualifiedKeyName on the model but it is failing when using a model extending Cristal\ApiWrapper\Bridges\Laravel\Model.
The "User" model is a standard Model class and the "Request" model is a model extending Cristal\ApiWrapper\Bridges\Laravel\Model.
I expect the result to be "requests.id".
>>> $u = new App\User;
=> App\User {#3752}
>>> $u->getQualifiedKeyName()
=> "users.id"
>>> $r = new App\Request;
=> App\Request {#4534
+exists: false,
+wasRecentlyCreated: false,
}
>>> $r->getQualifiedKeyName()
Exception with message 'Call to a member function getQualifiedKeyName() on array'
mathieufrh commented
Ok I have declared the functions in the Model.php and it is working now.
camillebaronnet commented
Hi @mathieufrh, thank you for taking the time to share your experience,
If you want, you can add this method on Cristal\ApiWrapper\Bridges\Laravel\Model
and open a pull request about it :)