While parameterized queries are the preferred method, sole() adds an extra layer of protection when using raw queries, especially when only one record should match.
PHP
#[RouteParameter] Does Not Bind Your Model
Michael Dyrynda explains a subtle Laravel gotcha: #[RouteParameter] only reads the current route parameter value, it does not perform implicit model binding. Good reminder that the controller signature still matters when you expect a bound Read more…