We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
To use SoftDeletes we have this:
use Illuminate\Database\Eloquent\SoftDeletes; public function resolveRouteBinding($value, $field = null) { return in_array(SoftDeletes::class, class_uses($this)) ? $this->where($this->getRouteKeyName(), $value)->withTrashed()->first() : parent::resolveRouteBinding($value); }
How can I make this work with laravel-optimus?
The text was updated successfully, but these errors were encountered:
You want to have ability to resolve soft deleted entities together with decoding?
Sorry, something went wrong.
Thanks, I think I solved it like this:
public function resolveRouteBinding($value, $field = null) { if (is_string($value) && ctype_digit($value)) { $value = (int) $value; } if (!is_int($value)) { return null; } $id = $this->getOptimus()->decode($value); return in_array(SoftDeletes::class, class_uses($this)) ? $this->where($this->getRouteKeyName(), '=', $id)->withTrashed()->first() : parent::resolveRouteBinding($value); }
No branches or pull requests
To use SoftDeletes we have this:
How can I make this work with laravel-optimus?
The text was updated successfully, but these errors were encountered: