Right now I have those.
user_add.blade.php
<form method="post" id="customForm" action="admin/user_add">
...
</form>
routes.php
Route::post('admin/user_add', 'admin@user_add');
admin.php
public function action_user_add()
{
print_r(Input::get());
}
How should I give the correct action path? Like; admin/user_add
or something like {{ Base_path }}admin/user_add
? I don't want issues when I move into production server. (e.g using subfolders etc.)
Also, is my approach correct or are there better ways?
Ps. Should I use Form methods? Like <input type="text" id="username" name="username" class="small">
to Form:text("username", "", "small");
Try this:
<form method="post" id="customForm" action="{{ URL::to_action('admin@user_add') }}">
Whether you want to use the form helpers or not, is really your choice. They make some things simpler, for example declaring the target URL, but they're a little cumbersome for writing additional HTML like you did (adding an id
attribute to the form).