Reputation: 634
I am new to laravel and php. I'm trying to get basic forms to work but when I want to use Route::post() I get an empty page. I have viewed multiple tutorials but can't find any differences between my (failing) code and the working examples.
My routes.php:
<?php
Route::get('/', function() {
return view('index');
});
Route::post('creating', function() {
return 'Creating something';
});
index.blade.php:
<br>
<form action='creating' method='post'>
<button type="submit"> Create something </button>
</form>
</br>
I'm using Laravel 5.0 and XAMPP on OS X Yosemite. As mentioned before:
localhost/test/public
will render a page with the 'Create something' button. But when pressing it, I get a blank page (url will then be: localhost/test/public/creating)
EDIT: I have tried changing 'creating' to '/creating', this made no difference.
EDIT2: Changing to:
Route::get(creating, function() {
return 'Creating something';
})
and
method = 'get'
Does work.
Upvotes: 2
Views: 1292
Reputation: 634
After checking the error logs (duh?!) I noticed the permissions for the storage/ directory were insufficient. After fixing this, I still needed to:
"illuminate/html": "5.0.*"
to the composer.json file.'lluminate\Html\HtmlServiceProvider'
to the providers array, and
'Form'=> 'Illuminate\Html\FormFacade',
'HTML'=> 'Illuminate\Html\HtmlFacade'
to the aliases array in the config/app.php file.{!! Form::token() !!}
to the ViewThis fixed the entire problem
Upvotes: 2