0

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");

asked Apr 6, 2013 at 20:51

1 Answer 1

1

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).

answered Apr 6, 2013 at 21:05
Sign up to request clarification or add additional context in comments.

2 Comments

Hi, thanks. I also have one more question. The project is medium sized and there will be over 50 calls to functions. If I write them inside Route.php, things will look really messy. Is there any solutions for this?
What kind of functions? Routing code belongs to route.php, other modifications to the system can be placed in start.php. And you can, of course, split up your logic into multiple different files, which you'd then include from start.php.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.