I have a small CRM system. I can create, update and delete a customer. I have also a detailed view for every customer. Now i want at the end of the single view a button: "Create Offer".
I have 2 Tables. 1 Table have the name: customer with some fields Name, Surname etc. I create the customer like this:
<form method="post" action="/mvs/mvs/public/admin/kunden">
<div class="container">
<div class="row">
<div class="col-md-12 col-md-offset-2" >
<div class="form-group">
<label for="vorname">Vorname</label>
<input type="text" class="form-control" name="vorname" id="vorname" placeholder="Vorname" value="" required>
</div>
<div class="form-group">
<label for="nachname">Nachname</label>
<input type="text" class="form-control" name="nachname" id="nachname" placeholder="Nachname" value="" required>
</div>
<div class="form-group">
<label for="strasse">Straße</label>
<input type="text" class="form-control" name="strasse" id="strasse" placeholder="Strasse" value="" required>
</div>
<div class="form-group">
<label for="plz">PLZ</label>
<input type="number" class="form-control" name="plz" id="plz" placeholder="Plz" value="" required>
</div>
<div class="form-group">
<label for="wohnort">Wohnort</label>
<input type="text" class="form-control" name="wohnort" id="wohnort" placeholder="Wohnort" value="" required>
</div>
<div class="form-group">
<label for="mail">Mail</label>
<input type="mail" class="form-control" name="mail" id="mail" placeholder="E-mail" value="" required>
</div>
<div class="form-group">
<label for="telefon">Telefon</label>
<input type="text" class="form-control" name="telefon" id="telefon" placeholder="Telefon" value="" required>
</div>
<div class="form-group">
<label for="geburtsdatum">Geburtsdatum</label>
<input type="date" class="form-control" name="geburtsdatum" id="geburtsdatum" placeholder="Geburtsdatum" value="" required>
</div>
<br>
<button type="submit" class="btn btn-primary">Kunden anlegen</button>
<a href=""><button type="submit" class="btn btn-danger">Abbrechen</button></a>
</div>
</div>
</div>
</form>
The detailed view is similar to that page. In the detailed view i made a button. The button is linked to the dynamic PDF Controller. The Dynamic PDF controller worked but i dont know how i get the data from the detailed view customer. I only get the data from ALL customers in the table.
here is the snippet:
function get_customer_data()
{
$customer_data = DB::table('kundens')
->limit(10)
->get();
return $customer_data;
}
I understand that this is wrong (iam beginner sorry for that) But i dont know how i can code, that i get the data from the customer that i chossed in the detailed view.
When i clicked on the button i want that the PDF is saved in the Database and is linked to that customer.
I hope i explained cleraly. When not please dont downrate - i try to explain better when its not enough.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire