Như Mark Davidson đã nói, không thể ra khỏi hộp. Nhưng đây là cách tôi đã xử lý.
Bây giờ nó có thể là quá mức cần thiết, nhưng tôi chuyển một loạt những gì cần thiết. Nếu không có tham số nào được truyền, thì các tuyến mặc định sẽ được tạo.
// Include the authentication and password routes
Route::auth(['authentication', 'password']);
/**
* Register the typical authentication routes for an application.
*
* @param array $options
* @return void
*/
public function auth(array $options = [])
{
if ($options) {
// Authentication Routes...
if (in_array('authentication', $options)) {
$this->get('login', 'Auth\[email protected]');
$this->post('login', 'Auth\[email protected]');
$this->get('logout', 'Auth\[email protected]');
}
// Registration Routes...
if (in_array('registration', $options)) {
$this->get('register', 'Auth\[email protected]');
$this->post('register', 'Auth\[email protected]');
}
// Password Reset Routes...
if (in_array('password', $options)) {
$this->get('password/reset/{token?}', 'Auth\[email protected]');
$this->post('password/email', 'Auth\[email protected]');
$this->post('password/reset', 'Auth\[email protected]');
}
} else {
// Authentication Routes...
$this->get('login', 'Auth\[email protected]');
$this->post('login', 'Auth\[email protected]');
$this->get('logout', 'Auth\[email protected]');
// Registration Routes...
$this->get('register', 'Auth\[email protected]');
$this->post('register', 'Auth\[email protected]');
// Password Reset Routes...
$this->get('password/reset/{token?}', 'Auth\[email protected]');
$this->post('password/email', 'Auth\[email protected]');
$this->post('password/reset', 'Auth\[email protected]');
}
}
Đối với trường hợp của bạn, bạn có thể có lẽ chỉ vượt qua một boolean
như tham số thay vì một array
. Nếu boolean là true
thì không tải các tuyến đường register
, nếu không tải mọi thứ.
Hy vọng điều đó sẽ hữu ích.