내 laravel 컨트롤러 클래스에서 메서드 오버로드 기능을 사용하려고합니다. 여기 내 방법Laravel 컨트롤러에서 메서드 오버로딩을 어떻게 사용합니까?
다음# Load Customer Balance View
public function createBalance()
{
return view('customer.balance');
}
# Load Customer Balance View
public function createBalance($CustomerID)
{
// show balance of the the defined customer
}
나의 길이다 -
// customer balance
Route::get('Customer/Balance', '[email protected]');
Route::get('Customer/Balance/{ID}', '[email protected]');
그러나 오류 표시 -
FatalErrorException in CustomerController.php line 45:
Cannot redeclare App\Http\Controllers\CustomerController::createBalance()
모든 솔루션하시기 바랍니다가?
수 없습니다. PHP는 그렇게 구축되지 않았습니다. – aynber
https://softwareengineering.stackexchange.com/questions/165467/why-php-doesnt-support-function-overloading – aynber
PHP OOP 언어가 아닙니까? 메소드 오버로딩 기능을 가진 OOP 언어의 기능. –