【发布时间】:2021-07-02 12:10:22
【问题描述】:
我正在使用 Laravel 8,我的应用程序在本地运行良好。现在我将应用程序上传到专用服务器,我收到以下错误:
BadMethodCallException 方法 App\Http\Controllers\User\SendMoneyController::index 不存在。
但是,此方法存在,并且在本地服务器上运行良好。
控制器
class SendMoneyController extends Controller
{
use AmlRulesVerification;
protected $sendMoneyInterface, $transactionInterface, $recipientInterface, $cardInterface, $homeInterface;
public function __construct(
SendMoneyInterface $sendMoneyInterface,
TransactionInterface $transactionInterface,
RecipientInterface $recipientInterface,
CardInterface $cardInterface,
HomeInterface $homeInterface
) {
$this->sendMoneyInterface = $sendMoneyInterface;
$this->transactionInterface = $transactionInterface;
$this->recipientInterface = $recipientInterface;
$this->cardInterface = $cardInterface;
$this->homeInterface = $homeInterface;
}
public function index(Request $request, $id = null)
{
$transaction = $this->sendMoneyInterface->getTransaction($request, $id);
if (isset($transaction['transaction']->card) && $transaction['transaction']->card) {
return redirect()->route('send.money.confirmation', ['id' => $id]);
}
return view('customers.send_money.index',
[
'data' => $transaction,
'countries' => $this->homeInterface->landingViewData($request)
]);
}
}
web.php
Route::group(['middleware'=>'languageSwitcher'],function () {
Auth::routes(['verify' => true]);
Route::get('/', [HomeController::class, 'landingView'])->name('landing.view');
Route::get('users/registration', [UserController::class, 'showRegisterForm'])->name('user.registration');
Route::get('localization/change/language', [LanguageSwitcher::class, 'changeLanguage'])->name('LangChange');
Route::post('/set/email/session', [UserController::class, 'setEmailInSession']);
Route::group(['middleware'=>'auth'],function () {
Route::get('/home', [HomeController::class, 'index'])->name('home');
Route::get('/send/money', [UserSendMoneyController::class, 'index'])->name('send.money.index');
)};
)};
【问题讨论】:
-
它在哪个文件/行上抛出错误?
-
你更新作曲家了吗?
-
当我更新时我显示不要以 root/超级用户身份运行 Composer!有关详细信息,请参阅getcomposer.org/root 使用包信息加载作曲家存储库来自repo.packagist.org 的警告:不推荐使用对 Composer 1 的支持,并且某些包将不可用。您应该升级到 Composer 2。请参阅 blog.packagist.com/deprecating-composer-1-support 更新依赖项(包括 require-dev)已杀死
标签: laravel laravel-controller