मार्क डेविडसन ने कहा, यह बॉक्स से बाहर संभव नहीं है। लेकिन इस तरह मैंने संभाला है।
अब यह अधिक हो सकता है, लेकिन मैं आवश्यकतानुसार एक सरणी के साथ गुजरता हूं। यदि कोई पैरामीटर पारित नहीं होता है, तो डिफ़ॉल्ट मार्ग बनाए जाते हैं।
// 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]');
}
}
अपने मामले के लिए, आप शायद सिर्फ एक boolean
एक array
के बजाय पैरामीटर के रूप में पारित कर सकते हैं। यदि बूलियन true
है तो register
मार्ग लोड न करें, अन्यथा सबकुछ लोड करें।
उम्मीद है कि यह मदद करता है।