however when I try to use my Cristal\ApiWrapper\Bridges\Laravel\Model class in AppServiceProvider::boot() like this
MyModel::setApi($this->app->make(Api::class));
I see this error:
Symfony\Component\ErrorHandler\Error\FatalError
Declaration of Cristal\ApiWrapper\Model::resolveRouteBinding($value) must be compatible with Illuminate\Contracts\Routing\UrlRoutable::resolveRouteBinding($value, $field = NULL)
Adding $field = NULL as the second parameter of Cristal\ApiWrapper\Model::resolveRouteBinding fixes that error, but then I see this error:
Class Cristal\ApiWrapper\Bridges\Laravel\Model contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Illuminate\Contracts\Routing\UrlRoutable::resolveChildRouteBinding)
I have to add this
/**
* Retrieve the child model for a bound value.
*
* @param string $childType
* @param mixed $value
* @param string|null $field
* @return \Illuminate\Database\Eloquent\Model|null
*/
public function resolveChildRouteBinding($childType, $value, $field)
{
return false;
}
to Cristal\ApiWrapper\Model to fix that error.
It looks like this project is not up to date with latest Illuminate\Contracts\Routing\UrlRoutable.
I'm following your guide here:
https://github.com/CristalTeam/php-api-wrapper/blob/master/docs/work-with-laravel.md
however when I try to use my Cristal\ApiWrapper\Bridges\Laravel\Model class in AppServiceProvider::boot() like this
MyModel::setApi($this->app->make(Api::class));
I see this error:
Adding $field = NULL as the second parameter of Cristal\ApiWrapper\Model::resolveRouteBinding fixes that error, but then I see this error:
Class Cristal\ApiWrapper\Bridges\Laravel\Model contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Illuminate\Contracts\Routing\UrlRoutable::resolveChildRouteBinding)
I have to add this
to Cristal\ApiWrapper\Model to fix that error.
It looks like this project is not up to date with latest Illuminate\Contracts\Routing\UrlRoutable.
This is what I have in my composer.json