Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Brian van Vlymen
12,637 Pointserror laravel with bootstrap
I am trying similarly to http://imgur.com/wIaWO0U with my Laravel. I have no idea where suppose the file should be exist. the Laravel i got error is http://imgur.com/xTXAOIz
Do you have have any idea to repair it?
Symfony\Component\HttpKernel\Exception\NotFoundHttpException thrown with message
Stacktrace:
#11 Symfony\Component\HttpKernel\Exception\NotFoundHttpException in C:\xampp\htdocs\laravel\fresh3\bootstrap\compiled.php:5692
#10 Illuminate\Routing\RouteCollection:match in C:\xampp\htdocs\laravel\fresh3\bootstrap\compiled.php:5009
#9 Illuminate\Routing\Router:findRoute in C:\xampp\htdocs\laravel\fresh3\bootstrap\compiled.php:4997
#8 Illuminate\Routing\Router:dispatchToRoute in C:\xampp\htdocs\laravel\fresh3\bootstrap\compiled.php:4989
#7 Illuminate\Routing\Router:dispatch in C:\xampp\htdocs\laravel\fresh3\bootstrap\compiled.php:717
#6 Illuminate\Foundation\Application:dispatch in C:\xampp\htdocs\laravel\fresh3\bootstrap\compiled.php:698
#5 Illuminate\Foundation\Application:handle in C:\xampp\htdocs\laravel\fresh3\bootstrap\compiled.php:7711
#4 Illuminate\Session\Middleware:handle in C:\xampp\htdocs\laravel\fresh3\bootstrap\compiled.php:8314
#3 Illuminate\Cookie\Queue:handle in C:\xampp\htdocs\laravel\fresh3\bootstrap\compiled.php:8261
#2 Illuminate\Cookie\Guard:handle in C:\xampp\htdocs\laravel\fresh3\bootstrap\compiled.php:10900
#1 Stack\StackedHttpKernel:handle in C:\xampp\htdocs\laravel\fresh3\bootstrap\compiled.php:659
#0 Illuminate\Foundation\Application:run in C:\xampp\htdocs\laravel\fresh3\public\index.php:49
app/views/registration.blade.php
@extends('layout')
@section('content')
<div class="row centered-form">
<div class="col-xs-12 col-sm-8 col-md-4 col-sm-offset-2 col-md-offset-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Please sign up <small>It's free!</small></h3>
</div>
<div class="panel-body">
@if(Session::get('errors'))
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h5>There were errors during registration:</h5>
@foreach($errors->all('<li>:message</li>') as $message)
{{$message}}
@endforeach
</div>
@endif
{{ Form::open() }}
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
{{ Form::text('first_name', null, array('class'=>'form-control input-sm','placeholder'=>'First Name')) }}
</div>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
{{ Form::text('last_name', null, array('class'=>'form-control input-sm','placeholder'=>'Last Name')) }}
</div>
</div>
</div>
<div class="form-group">
{{ Form::email('email', null, array('class'=>'form-control input-sm','placeholder'=>'Email Address')) }}
</div>
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
{{ Form::password('password', array('class'=>'form-control input-sm','placeholder'=>'Password')) }}
</div>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
{{ Form::password('password_confirmation', array('class'=>'form-control input-sm','placeholder'=>'Confirm Password')) }}
</div>
</div>
</div>
{{ Form::submit('Register', array('class'=>'btn btn-info btn-block')) }}
{{ Form::close() }}
</div>
</div>
</div>
</div>
@stop
app/routes.php
Route::post('register', function()
{
$rules = [
'first_name' => 'required',
'last_name' => 'required',
'email' => 'required|email',
'password' => 'required|confirmed'
];
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails())
{
return Redirect::to('register')->withInput()->withErrors($validator);
}
return 'Form passed validation!';
});
app/views/layout.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Using a Blade layout</title>
<!-- Bootstrap CSS served from a CDN -->
<link
href="http://netdna.bootstrapcdn.com/bootswatch/3.1.0/superhero/bootstrap.min.css"
rel="stylesheet">
<style>
body{
background: url("img/stardust.png");
}
.centered-form .panel{
background: rgba(255, 255, 255, 0.8);
box-shadow: rgba(0, 0, 0, 0.3) 20px 20px 20px;
color: #4e5d6c;
}
.centered-form{
margin-top: 60px;
}
</style>
</head>
<body>
<div class="container">
@yield('content')
</div>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js">
</script>
</body>
</html>
2 Answers
Brian van Vlymen
12,637 PointsHi, Chris I was following the book Integration Front end Components with Web Applications. I decided to do all over again I found there were error was on my app/routes.php. I did not add the open and close <?php ?> and Route::get('register', function() { return View::make('registration'); });
Also, I did not realized with this route in place, the registration page will be rendered when the user goes to "/register" URL relative to the application.
<?php
Route::get('register', function()
{
return
View::make('registration');
});
Route::post('register', function()
{
$rules = [
'first_name' => 'required',
'last_name' => 'required',
'email' => 'required|email',
'password' => 'required|confirmed'
];
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails())
{
return Redirect::to('register')->withInput()->withErrors($validator);
}
return 'Form passed validation!';
});
?>
Chris Shaw
26,676 PointsSo you're all good now? Let me know if you still have problems.
Brian van Vlymen
12,637 PointsI would strongly recommend you a book its such a good book! I am giving you an example link is https://leanpub.com/frontend/read. I only have a little of time to read I though it was not for me till I read it I realized its for me... yes , all I am good now smile. thanks Chris! I remember you. The last time spoke with you related to SSH. Honestly, I am having hard time to get interaction with SSH since the MAC is much easier to set up compare to Windows. I need take it break for a while without using the vagrant since I am using Windows, but I am glad you were helping me out!
Chris Shaw
26,676 PointsChris Shaw
26,676 PointsHi Brian,
Could you please explain a little more what your doing to get this error as to me there's a more immediate issue which is you're running Laravel directly from a sub-folder instead of a virtual host, sub-folders won't work unless you set them up correctly but by default Laravel doesn't expect this so it doesn't change anything.
Also it's recommended that you use Homestead for developing with Laravel as it's optimized for it and is always updated, some other things that concern me is you have only supplied a route with uses a POST HTTP verb but no default landing route.
If you could please clarify this that would be great.