Last active
August 29, 2015 14:13
-
-
Save tommymarshall/e90112157a8d76c6d4f1 to your computer and use it in GitHub Desktop.
Route::post() requests never get matched, requests always end up matching Route::get(). Here's a gif of what's happenning: http://cl.ly/image/3s0X0q2p0r1o
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PagesController extends BaseController | |
{ | |
public function home() { | |
return View::make("pages.home"); | |
} | |
public function about() { | |
return View::make("pages.about"); | |
} | |
public function vision() { | |
return View::make("pages.vision"); | |
} | |
public function subscription() { | |
return View::make("pages.subscription"); | |
} | |
public function create() { | |
die(var_dump(Input::all())); | |
exit; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Home | |
Route::get('home', 'PagesController@home'); | |
// Pages | |
Route::get('page', [['about'], 'uses' => 'PagesController@about']); | |
Route::get('page', [['vision'], 'uses' => 'PagesController@vision']); | |
Route::get('page', [['subscription'], 'uses' => 'PagesController@subscription']); | |
// Subscription | |
Route::post('page', [['subscription'], 'uses' => 'PagesController@create']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@extends('layouts.base') | |
@section('content') | |
<h1>Subscribe</h1> | |
{{ Form::open('subscription') }} | |
Name: <input type="text" name="name" id="name"><br> | |
Email: <input type="email" name="email" id="email"><br> | |
<input type="submit" value="Submit"> | |
{{ Form::close() }} | |
@stop |
That did it :) Awesome! Thank you.
Great 😄 A 1.1.1 minor update should be available for the end of the week so you'll be up to date for using the framework on your projects.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You expect the right behavior ;) I found your issue. WordPress is kind of a bitch because it has some reserved variables that you can't use for your input attributes. Check this page for a list of input names to avoid: http://codex.wordpress.org/WordPress_Query_Vars#Query_variables
The issue is your name input attribute
name
. When you develop with WordPress it is best practice to prefix your name attributes. Simply replace your attribute value like this for exampleapp_name
and it should work as expected.Also, in order to output some inputs, you can leverage the
Form
class:Let me know if this fix your issue. Cheers ;)