You need another route to display the contact form page
Route::get('contact', function() {
return View::make('contact');
});
Domanda
i am pretty new to framework and laravel in general, im struggling to learn laravel, and i have found this book.
https://leanpub.com/learninglaravel
I hope is a good start. (usually i coded in php and html)
I have a problem following the basic tutorial (:/ not a good start lol)
Routes.php
Route::post('contact', function()
{
$data = Input::all();
$rules = array(
'subject' => 'required',
'message' => 'required'
);
$validator = Validator::make($data, $rules);
if($validator->fails()) {
return Redirect::to('contact')->withErrors($validator)->withInput();
}
return 'Your message has been sent';
});
Route::get('/', function()
{
return View::make('home');
});
Route::get('about', function()
{
return View::make('about');
});
Contact.blade.php
@extends('layout')
@section('content')
<h1>Contact Us.</h1>
<p>Please contact us by sending a message using the form below:</p>
{{ HTML::ul($errors->all(), array('class'=>'errors'))}}
{{ Form::open(array('url' => 'contact')) }}
{{ Form::label('Subject') }}
{{ Form::text('subject','Enter your subject') }}
<br />
{{ Form::label('Message') }}
{{ Form::textarea('message','Enter your message') }}
<br />
{{ Form::submit() }}
{{ Form::close() }}
@stop
THe other pages works well
Soluzione
You need another route to display the contact form page
Route::get('contact', function() {
return View::make('contact');
});