При попытке доступа к этому URL-адресу "пользователи/логин" я получил эту ошибку. Вот мой код:
Просмотреть пользователей /login.blade.php:
<head>Sign in : </head>
<body>
{{ HTML::ul($errors->all()) }}
<?php echo Form::open(array('url' => 'users'));
echo '<div class="form-group">';
echo Form::label('username', 'User Name');
echo Form::text('ausername', null, array('class' => 'form-control'));
echo '</div>';
echo '<div class="form-group">';
echo Form::label('Password', 'Password');
echo Form::password('apassword', null, array('class' => 'form-control'));
echo '</div>';
echo Form::submit('Sign in', array('class' => 'btn btn-primary'));
echo Form::close();
?>
</body>
Контроллер Usercontroller.php
<?php
class UserController extends BaseController {
public function index()
{
$users = User::all();
return View::make('users.index')
->with('users', $users);
}
public function create()
{
return View::make('users.create');
}
public function store()
{
$rules = array(
'username' => 'required|alpha_dash',
'password' => 'required|confirmed',
'name' => 'required|regex:/^[a-zA-Z][a-zA-Z ]*$/',
'email' => 'required|email|unique:users',
'country' => 'required'
);
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::to('users/create')
->withErrors($validator)
->withInput(Input::except('password'));
} else {
$user = new User;
$user->username = Input::get('username');
$user->password = Hash::make(Input::get('password'));
$user->name = Input::get('name');
$user->email = Input::get('email');
$user->country = Input::get('country');
$user->save();
// redirect
Session::flash('message', 'Successfully created user!');
return Redirect::to('users');
}
}
public function login()
{
$reflector = new ReflectionClass("UserController");
$fn = $reflector->getFileName();
dd($fn);
return View::make('users.login');
}
public function authen()
{
if (Auth::attempt(array('username' => Input::get('ausername'), 'password' => Input::get('apassword'))))
{
return Redirect::intended('users');
}
}
}
и мои маршруты .php
<?php
Route::resource('users','UserController');
Route::get('users/login', '[email protected]');
Route::get('/', function()
{
return View::make('hello');
});
Это проблема маршрута, спасибо за помощь