Mam taki problem mam przykład w laravelu, który polega na tym, że jest sobie strona rejestracji i jest routing, który sprawdza czy dane pola zostały poprawnie wypełnione w przypadku kiedy zostały źle wypełnione to wszystko działa dobrze bo pojawia się komunikat, o tym, że by je poprawić natomiast w przypadku kiedy ma nastąpić przekierowanie do właściwej strony wywala błąd w logach apacha nie ma żadnego błędu.
Route::post('registration', array('before' => 'csrf',
function()
{
$rules = array(
'email' => 'required|email|unique:users',
'password' => 'required|same:password_confirm',
'name' => 'required'
);
$validation = Validator::make(Input::all(), $rules);
if ($validation->fails())
{
//return Redirect::to('registration')->withErrors($validation)->withInput();
return "dobrze";
}
$user = new User;
$user->email = Input::get('email');
$user->password = Hash::make(Input::get('password'));
$user->name = Input::get('name');
$user->admin = Input::get('admin') ? 1 : 0;
if ($user->save())
{
Auth::loginUsingId($user->id);
return Redirect::to('profile');
}
//return View::make('registration');
//return "źle";
}));
Route::get('registration', function()
{
return View::make('registration');
});
Route::get('profile', function()
{
//if (Auth::check())
//{
//return 'Witamy! Zostałeś uwierzytelniony!';
//}
//else
//{
return 'Proszę się <a href="login">zalogować</a>';
//}
});
Plik registration.php
<!DOCTYPE html>
<html>
<head>
<title>Uwierzytelnianie w Laravelu - rejestracja
</title>
<meta charset="utf-8">
</head>
<body>
<h2>Uwierzytelnianie w Laravelu - rejestracja</h2>
<?php $messages = $errors->all('<p style=
"color:red">:message</p>') ?>
<?php foreach ($messages as $msg): ?>
<?= $msg ?>
<?php endforeach; ?>
<?= Form::open() ?>
<?= Form::label('email', 'Adres email: ') ?>
<?= Form::text('email', Input::old('email')) ?>
<br>
<?= Form::label('password', 'Hasło: ') ?>
<?= Form::password('password') ?>
<br>
<?= Form::label('password_confirm',
'Potwierdź hasło: ') ?>
<?= Form::password('password_confirm') ?>
<br>
<?= Form::label('name', 'Nazwa: ') ?>
<?= Form::text('name', Input::old('name')) ?>
<br>
<?= Form::label('admin', 'Administrator?: ') ?>
<?= Form::checkbox('admin','true',
Input::old('admin')) ?>
<br>
<?= Form::submit('Zarejestruj!') ?>
<?= Form::close() ?>
</body>
</html>