У меня есть use Illuminate\Support\Facades\Input;
, объявленный в начале моего контроллера, поэтому я не уверен, почему он выбрасывает эту ошибку. Я не могу проверить это очень хорошо, потому что форма работает только на производственном сервере, а не на моем сервере разработки.Получение ошибки Класс «Приложение Http Controllers Input» не найден на рабочем сервере
Это контроллер
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use Validator;
use Redirect;
use Mail;
use App\Http\Requests;
class contact extends controller
{
// This function will show the view
public function showForm()
{
return view('pages.contact');
}
public function handleFormPost()
{
$input = Input::only('name', 'email', 'msg');
$validator = Validator::make($input,
array(
'name' => 'required',
'email' => 'required|email',
'msg' => 'required',
)
);
if ($validator->fails())
{
return Redirect::to('contact')->with('errors', $validator->messages());
} else { // the validation has not failed, it has passed
// Send the email with the contactemail view, the user input
Mail::send('contactemail', $input, function($message)
{
$message->from('[email protected]', 'Your Name');
$message->to('[email protected]');
});
// Specify a route to go to after the message is sent to provide the user feedback
return Redirect::to('thanks');
}
}
}
Это форма
<div class="container">
<h1>A basic contact form</h1>
<form id="contact" method="post" class="form" role="form">
@if(Session::has('errors'))
<div class="alert alert-warning">
@foreach(Session::get('errors')->all() as $error_message)
<p>{{ $error_message }}</p>
@endforeach
</div>
@endif
<div class="row">
<div class="col-xs-6 col-md-6 form-group">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input class="form-control" id="name" name="name" placeholder="Name" type="text"autofocus="">
</div>
<div class="col-xs-6 col-md-6 form-group">
<input class="form-control" id="email" name="email" placeholder="Email" type="text">
</div>
</div>
<textarea class="form-control" id="message" name="msg" placeholder="Message" rows="5"></textarea>
<br>
<div class="row">
<div class="col-xs-12 col-md-12 form-group">
<button class="btn btn-primary pull-right" type="submit">Submit</button>
</div>
</div>
</form>
</div>
Любая помощь будет принята с благодарностью! Благодаря!
Почти такая же почта из другого аккаунта? Вы должны были отредактировать [этот] (http://stackoverflow.com/questions/37202978/fatal-error-class-app-http-controllers-input-not-found-when-sending-a-form) вместо публикации новый вопрос с другого аккаунта. –
Это другая проблема. Извините, если я плохо его подаю. Просто хочу исправить проблему, чтобы я мог спать – user2238780
@ user2238780 Похож на ту же проблему, с тем же ответом. – ceejayoz