Closed czernika closed 2 years ago
Hi @czernika Yes, we use a different way of defining parameters. And I'm not sure that we should fix it in this class. We have another way of binding that you can change in your screen:
use Orchid\Screen\Resolvers\RouteDependencyResolver;
/**
* @param string $method
* @param array $httpQueryArguments
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException
* @throws \ReflectionException
*
* @return array
*/
protected function resolveDependencies(string $method, array $httpQueryArguments = []): array
{
return app()->make(RouteDependencyResolver::class)->resolveScreen($this, $method, $httpQueryArguments);
}
It already uses the Laravel methods you refer to. Could you confirm the performance or lack of it when using this method?
@tabuna Thanks with this method it works as charm)
Describe the bug
Hi!
I found out that
withTrashed()
route method is not working withscreen
- it will throw 404 error on soft deleted models (User
model hasSoftDeletes
trait anddeleted_at
column is present)To Reproduce Steps to reproduce the behavior:
/admin/users/9
Expected behavior User screen with information about deleted user with id 9
Additional context If I change route to get
id
as a parameter and found soft deleted model by my own within Screen(User::withTrashed()->findOrFail($id)
) it will work. So my guess the problem is with model binding ofquery
methodProposed Solution
When I start digging deeper I found that if I change this lines of
ScreenDependencyResolver
into
withTrashed()
method will show soft deleted models page when it's present and throw 404 when it's not.These lines are basically the copy of Laravel way of resolving routes query dependencies for soft deleted models but I'm not entirely sure about this as a lack of knowledge about Laravel - that's why I am addressing this as an issue