-
-
Save tommymarshall/e90112157a8d76c6d4f1 to your computer and use it in GitHub Desktop.
<?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; | |
} | |
} |
<?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']); |
@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 |
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 example app_name
and it should work as expected.
Also, in order to output some inputs, you can leverage the Form
class:
Form::text('app_name');
Form::email('app_email');
Form::submit('submit', 'Submit');
Let me know if this fix your issue. Cheers ;)
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.
I expect that
PagesController@create
should be fired when I submit the form onsubscription.scout.php
, but it never does. Instead, the request matches theget
request for the subscription uri.