Не понимаю почему не работает форма. Вот роуты:
Route::get('fill-profile', 'ProfileController@fill')->middleware('auth')->name('fill-profile');
Route::post('store-profile', 'ProfileController@store')->middleware('auth')->name('store-profile');
Вот сам контроллер:
class ProfileController extends Controller
{
public function store(CreateProfileRequest $request)
{
dd(\Auth::user());
$name = \Auth::user()->name;
$profile = new Profile();
$profile->location = \Auth::user()->location->place . ', ' . \Auth::user()->location->country;
$profile->name = $name;
$profile->surname = $request->surname;
$profile->age = $request->age;
$profile->gender = $request->gender;
$profile->skype = $request->skype;
$profile->discord = $request->discord;
$profile->about = $request->about;
$profile->user_id = \Auth::user()->id;
$profile->save();
return redirect()->route('profile')->with('slug', $name);
}
public function fill()
{
// Check if logged in
if (!(\Auth::check())) {
return Redirect::to('/login');
}
// check if user account is active
if (! \Auth::user()->isActive()) {
\Auth::logout();
return redirect('login')->with('error', trans('auth.deactivated'));
}
$user = \Auth::user();
return view('frontend.user.fill', ['user' => $user]);
}
}
А вот сама форма:
<form name="account-fill" action="{{ route('store-profile') }}" method="POST">
{!! csrf_field() !!}
<input type="text" name="surname" placeholder="Enter your surname">
<input type="number" name="age" placeholder="How old are you?">
<h4>Select your gender:</h4>
<select name="gender" form="account-fill">
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
<h4>Add some contact information:</h4>
<input type="text" placeholder="Enter your Skype login here">
<input type="text" placeholder="Enter your Discord login here">
<h4>Tell us something about you:</h4>
<textarea name="about" cols="60" rows="10" placeholder="Hey, type here something about yourself"></textarea>
<input type="submit" class="btn" value="Send">
</form>
Вроде всё должно работать, но при нажатии send просто обновляется страница и поля пустыми становятся. При этом если в action вбиваю просто '/' или какой-то левый маршрут, то выкидывает 404 или 405.