I\'m trying to create a set of rules under the new \\HTTP\\Requests\\UpdateArticle
class for the slug
field, which needs to have unique
fi
You can retrieve route parameters by name with input()
:
$id = Route::input('id');
return [
// ...
'slug' => 'required|unique:articles,id,' . $id,
// ...
];
It's right there in the docs (scroll down to Accessing A Route Parameter Value)
To get URL parameters from the URL:
$this->route('id');
A great discussion on this were also asked here.