Recover Data to Controller in Laravel

Asked

Viewed 331 times

0

I am developing a web application with Laravel and on one of my screens I have a Customer and Contact relationship, where a client can have multiple contacts.

So in my View I have a method to add my contacts to a table. for example: I inform the fields cellular, phone and email and click add contact and it will save ...

my question is, how can I send this data to my client controller?

[EDIT]

I have a create-DIT Client screen. where I have the customer data: Name, Number, Email ... and then I have 3 cell fields, phone and email and an add button, where I inform these 3 fields and add in the table. my problem is when sending information from this table to the server.

  • From Front-End to Back-End in Laravel? Take a look at this https://stackoverflow.com/questions/27346205/submit-form-laravel-using-ajax In this example he is sending a new comment to be added by the controller using the add method he created

  • I could only send this via ajax? I can’t send the data via form? with all the client’s registration at once

  • Form you would have to update your page and the table would be lost, go for me, use ajax and update the table using Jquery is more robust and easy to maintain. (If you want to use pure Javascript, without Jquery and Ajax, it’s also a good one)

  • The ajax you can also submit the whole form

  • I understood, but in case it would have to be by the same form :/ because so I send up this data would have to give a redirect and change the route

  • then just use action="<?= $host? >+'controller/method'" in the form

  • I already have a form, and I am already sending the information ... the problem is that the table data will not ... {!! Form::open(['route' => 'customers.store', 'class'=>'form']) !!}

  • Table does not load form data, only input

  • And what is the best method to pass data from a table to the controller?

  • Depending on the Table Build Plugin, jquery can recover the object with the data and you send by ajax, check if it succeeded, if yes, you call another method to change the route

  • The comments just left the most confusing question, you have a table where you list customers and these customers will have contact registrations on the same page where customers are listed right? If possible you could show how your tables are to get a sense of what has been done?

  • I will try to update my question regarding this comment you made.

Show 7 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.